void Awake()
 {
     //Can use a less precise h to speed up calculations
     //Or a more precise to get a more accurate result
     //But lower is not always better because of rounding errors
     h = Time.fixedDeltaTime * 1f;
     //gunObj.rotation = transform.rotation;
     lineRenderer = gunObj.GetComponent <LineRenderer>();
     mousePos     = Vector2.zero;
     controller   = GetComponent <CharacterMovementTutorial>();
 }
    // Use this for initialization
    void Start()
    {
        self   = GetComponent <PlayerSelector>().me;
        other  = GetComponent <PlayerSelector>().notMe;
        myChar = GameObject.Find("Player" + self[1]).GetComponent <CharacterMovementTutorial>();
        rb     = GetComponent <Rigidbody>();
        // Find all lightning balls currently in the scene, add only the ones fired by current player to the list
        var meBalls = GameObject.FindGameObjectsWithTag("LightningBall");

        foreach (GameObject lBall in meBalls)
        {
            //Debug.Log("lball: " + lBall.GetComponent<LightningBallTrigger>().self + " me: " + self);
            if (lBall.GetComponent <LightningBallTrigger>().self == self)
            {
                lightningBalls.Add(lBall);
            }
        }
        //Debug.Log("fired bball");
        //Debug.Log(lightningBalls.Count);
    }
Esempio n. 3
0
 // Use this for initialization
 void Start()
 {
     controller         = GetComponentInParent <CharacterMovementTutorial>();
     transform.position = myCharacter.transform.position;
     transform.rotation = myCharacter.transform.rotation;
 }