SetX() public method

Modify X axis
public SetX ( float x ) : void
x float
return void
    void OnAreaChange(Areas before, Areas after) {
      if ((after & Areas.Ladder) == Areas.Ladder) {
        if (character.ladder.IsAboveTop(character, character.feet)) {
          inputMgr.SetY(-1);
        } else {
          inputMgr.SetY(1);
        }

        inputMgr.SetX(0);
        UpdateManager.instance.SetTimeout(ContinueMoving, 2.5f);
      } else {
        inputMgr.SetX((float)facing);
      }
    }
 /// <summary>
 /// Listen InstancePrefab SendMessage and start logic
 /// </summary>
 public void OnInstancePrefab(InstancePrefab prefab) {
   inputMgr = prefab.instance.GetComponentInChildren<AIInput>();
   if (inputMgr == null) {
     Debug.LogWarning("AIInput is expected in the prefab");
     return;
   }
   inputMgr.SetX(-1);
 }
Example #3
0
 public void OnInstancePrefab(InstancePrefab prefab)
 {
     inputMgr = prefab.instance.GetComponentInChildren <AIInput>();
     if (inputMgr == null)
     {
         Debug.LogWarning("AIInput is expected in the prefab");
         return;
     }
     inputMgr.SetX(-1);
 }
    /// <summary>
    /// Listen InstancePrefab SendMessage and start logic
    /// </summary>
    public void OnInstancePrefab(InstancePrefab prefab) {
      inputMgr = prefab.instance.GetComponentInChildren<AIInput>();
      if (inputMgr == null) {
        Debug.LogWarning("AIInput is expected in the prefab");
        return;
      }
      pc2d = prefab.instance.GetComponentInChildren<PlatformerCollider2D>();


      inputMgr.SetX(1);

      pc2d.onLeftWall += OnLeftWall;
      pc2d.onRightWall += OnRightWall;
    }
    public void OnInstancePrefab(InstancePrefab prefab) {
      inputMgr = prefab.instance.GetComponentInChildren<AIInput>();
      if (inputMgr == null) {
        Debug.LogWarning("AIInput is expected in the prefab");
        return;
      }
      pc2d = prefab.instance.GetComponentInChildren<PlatformerCollider2D>();
      character = prefab.instance.GetComponentInChildren<Character>();


      inputMgr.SetX(1);
      character.onAreaChange += OnAreaChange;
      pc2d.onLeftWall += OnLeftWall;
      pc2d.onRightWall += OnRightWall;
    }
    public override void OnAwake(bool notify = true) {
      base.OnAwake(notify);


      aiInput = instance.GetComponentInChildren<AIInput>();
      if (aiInput == null) {
        Debug.LogWarning("AIInput is expected in the prefab");
        return;
      }
      pc2d = instance.GetComponentInChildren<PlatformerCollider2D>();
      character = instance.GetComponentInChildren<Character>();


      aiInput.SetX(1);
      character.onAreaChange += OnAreaChange;
      character.onStateChange += OnStateChange;
      pc2d.onLeftWall += OnLeftWall;
      pc2d.onRightWall += OnRightWall;
    }
Example #7
0
 void OnLeftWall()
 {
     inputMgr.SetX(1);
 }