Example #1
0
 private void Awake()
 {
     rb = GetComponent <Rigidbody>();
     mechaController      = GetComponent <MechaController>();
     canon                = GetComponent <CannonBehavior>();
     _currentMaxSideSpeed = BaseSideSpeed;
 }
Example #2
0
 void Start()
 {
     if (ObjectsToSwitchOnWhenDark != null)
     {
         for (var i = 0; i < ObjectsToSwitchOnWhenDark.Length; i++)
         {
             ObjectsToSwitchOnWhenDark[i].SetActive(false);
         }
     }
     _cannonBehavior = Camera.main.GetComponent <CannonBehavior>();
 }
Example #3
0
    // Use this for initialization
    void Start()
    {
        //Sets the velocity based on direction booleans from source
        CannonBehavior sourceStats = GetComponentInParent <CannonBehavior>();

        direction = Vector3.zero;
        speed     = sourceStats.setSpeed;
        setSpeed  = speed;

        if (sourceStats.goesLeft)
        {
            direction += Vector3.left;
        }
        else if (sourceStats.goesRight)
        {
            direction += Vector3.right;
        }

        if (sourceStats.goesUp)
        {
            direction += Vector3.up;
        }
        else if (sourceStats.goesDown)
        {
            direction += Vector3.down;
        }

        Vector3 knockback = direction * KNOCKBACK_FACTOR;

        //Sets other variables
        ball = GetComponent <Transform>();
        float damage = GetComponent <ProjectileStatus>().damage;

        dmgPackage  = new DamagePackage(damage, knockback);
        curDistance = 0;
        GetComponent <ProjectileStatus>().source = transform.root;

        //Detach from parent
        transform.parent = null;
    }