Beispiel #1
0
    protected virtual void Awake()
    {
        GameObject player = null;
        foreach(GameObject obj in GameObject.FindGameObjectsWithTag("Player"))
        {
            if (obj.name == "Sal")
            {
                player = obj;
                break;
            }
        }

        if(!player)
            Debug.LogError("Could not find player in Scene");

        if(!mPlayerActivate)
            mPlayerActivate = player.GetComponent<PlayerActivationHandler>();
        if(!mCloneActivate)
            mCloneActivate = player.GetComponent<CloneActivationHandler>();
    }
    void Start()
    {
        anim = GetComponent<Animator>();
        anim.SetLayerWeight(1, 1.0f);
        anim.SetLayerWeight(2, 1.0f);
        timeScript = GetComponent<TimeActions>();
        camScript = GetComponent<ThirdPersonCamera>();
        activationHandler = GetComponent<ActivationHandler>();
        weapHandler = GetComponent<WeaponHandler>();
        ammoScript = GetComponent<Ammo>();
        playerActivationHandler = GetComponent<PlayerActivationHandler>();
        cloneActivationHandler = GetComponent<CloneActivationHandler>();
        flash = GameObject.Find("Flash").GetComponent<Screenflash>();
        if(anim.layerCount == 2)
        anim.SetLayerWeight(1, 1);

        mMoving = false;

        anim.SetBool("GetUp", getUpAtStart);
    }