public void Awake()
 {
     instance     = this;
     rb           = GetComponent <Rigidbody>();
     anim         = GetComponent <Animator>();
     healthSystem = GetComponent <HealthSystem>();
 }
示例#2
0
    void Awake()
    {
        instance  = this;
        healthBar = GetComponent <HealthBar>();
        agent     = GetComponent <NavMeshAgent>();
        anim      = GetComponent <Animator>();

        animationListener.animprofils.Add(new AnimationListener.Animprofil(AnimationListener.AnimType.throwing, () =>
        {
            Debug.Log("Top Fırladı");
            currentball.GetComponent <SphereCollider>().enabled = true;
            float x       = ballthrowforce * 2f / 3f;
            float y       = ballthrowforce - x;
            Vector3 force = (transform.up * x) + (transform.forward * y);
            currentball.AddComponent <Rigidbody>().AddForce(force);

            currentball.GetComponent <Rigidbody>().useGravity = true;
            currentball.transform.SetParent(null);
            currentball = GameManager.instance.CreateBomb(bombpoint);
        }));
    }