Adventure Creator Wikia
No edit summary
Tags: Visual edit apiedit
m (Added link to Simple Touch Controller integration)
Tag: Visual edit
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
  +
'''NOTE: CN Controls has been deprecated - a similar script that works with [https://assetstore.unity.com/packages/tools/input-management/simple-touch-controller-74107 Simple Touch Controller] can be found [http://adventure-creator.wikia.com/wiki/Simple_Touch_Controller_integration here].'''
Same as rewired's Integration, attach the script to any active
 
  +
<nowiki> </nowiki>object in the hierarchy, which you know is always going to exist on
 
  +
<nowiki> </nowiki>This script allows you to integrate the free [https://www.assetstore.unity3d.com/en/#!/content/15233 CN Controls] asset to AC.
every scene, or which doesn't get destroyed on loading (You may also put
 
  +
<nowiki> </nowiki>it on the AC persistent engine or game engine prefabs). Also, make sure
 
<nowiki> </nowiki>CN Controls' Virtual Joystick is using "Vertical" and "Horizontal" as
+
Same as Rewired's integration, attach the script to any active<nowiki> </nowiki>object in the hierarchy, which you know is always going to exist on every scene, or which doesn't get destroyed on loading (You may also put<nowiki> </nowiki>it on the AC PersistentEngine or GameEngine prefabs). Also, make sure<nowiki> </nowiki>CN Controls' Virtual Joystick is using "Vertical" and "Horizontal" as the input names.
  +
using UnityEngine;<br>
the input names.<blockquote>using UnityEngine;</blockquote><blockquote>using CnControls;</blockquote><blockquote>public class ACInputCNControls : MonoBehaviour</blockquote><blockquote>{</blockquote><blockquote>void Start()</blockquote><blockquote>{</blockquote><blockquote>//Call AC delegate for the joystick Axis</blockquote><blockquote>AC.KickStarter.playerInput.InputGetAxisDelegate = CustomGetAxis;</blockquote><blockquote>}</blockquote><blockquote><br>
 
  +
using CnControls;<br>
</blockquote><blockquote>private float CustomGetAxis(string AxisName)</blockquote><blockquote>{</blockquote><blockquote>//get the axis from CNControls' joystick </blockquote><blockquote>return CnInputManager.GetAxis(AxisName);</blockquote><blockquote>}</blockquote><blockquote>}</blockquote>
 
  +
<br>
  +
public class ACInputCNControls : MonoBehaviour<br>
  +
{<br>
  +
  void Start()<br>
  +
  {<br>
  +
    //Call AC delegate for the joystick Axis<br>
  +
    AC.KickStarter.playerInput.InputGetAxisDelegate = CustomGetAxis;<br>
  +
  }<br>
  +
<br>
  +
  private float CustomGetAxis(string AxisName)<br>
  +
  {<br>
  +
    //get the axis from CNControls' joystick <br>
  +
    return CnInputManager.GetAxis(AxisName);<br>
  +
  }<br>
  +
}
  +
  +
   
 
== ==
 
== ==

Latest revision as of 02:44, 16 April 2018

NOTE: CN Controls has been deprecated - a similar script that works with Simple Touch Controller can be found here.

This script allows you to integrate the free CN Controls asset to AC.

Same as Rewired's integration, attach the script to any active object in the hierarchy, which you know is always going to exist on every scene, or which doesn't get destroyed on loading (You may also put it on the AC PersistentEngine or GameEngine prefabs). Also, make sure CN Controls' Virtual Joystick is using "Vertical" and "Horizontal" as the input names.

using UnityEngine;
using CnControls;

public class ACInputCNControls : MonoBehaviour
{
  void Start()
  {
    //Call AC delegate for the joystick Axis
    AC.KickStarter.playerInput.InputGetAxisDelegate = CustomGetAxis;
  }

  private float CustomGetAxis(string AxisName)
  {
    //get the axis from CNControls' joystick
    return CnInputManager.GetAxis(AxisName);
  }
}


[]