Пример #1
0
    private void SpawnObject()
    {
        GameObject gameObject = GameObject.Instantiate(spawnObject, parryPosition, Quaternion.identity);
        Directable directable = gameObject.GetComponent <Directable>();

        if (directable != null)
        {
            directable.DirectToward(GetInputDirection());
        }
        hasSpawnedObject = true;
    }
Пример #2
0
    void Start()
    {
        directableComp = GetComponent <Directable> ();
        rangeTransform = new GameObject("Range Transform").transform;
        rangeTransform.SetParent(transform);
        rangeTransform.localPosition = new Vector3(0, -fireRange, 0);
        fireTransform = new GameObject("Fire Transform").transform;
        fireTransform.SetParent(transform);
        fireTransform.localPosition = new Vector3(0, -1, 0);

        EnableFire();
    }
Пример #3
0
    public void OnHit(Directable other)
    {
        animator.SetBool("IsBouncing", true);
        Vector2 otherDirection = other.GetDirection();
        Vector2 newDirection;

        if (mirrorType == MirrorType.HORIZONTAL)
        {
            // flip the x direction
            newDirection = new Vector2(otherDirection.x * -1, otherDirection.y);
        }
        else
        {
            // flip the y direction
            newDirection = new Vector2(otherDirection.x, otherDirection.y * -1);
        }
        other.DirectToward(newDirection);
    }
 void Awake()
 {
     directable = GetComponent <Directable>();
 }
 void Awake()
 {
     spriteRenderer = GetComponent <SpriteRenderer>();
     directable     = GetComponent <Directable>();
 }
Пример #6
0
 public void setRow(Directable directable)
 {
     Row = directable;
 }
Пример #7
0
 public void setDown(Directable directable)
 {
     Down = directable;
 }
Пример #8
0
 public void setRight(Directable directable)
 {
     Right = directable;
 }
Пример #9
0
 public void setLeft(Directable directable)
 {
     Left = directable;
 }
Пример #10
0
 void Start()
 {
     directable   = GetComponent <Directable>();
     currentPoint = pointA;
 }