示例#1
0
    public void Init()
    {
        SetupAnimator();

        rigid             = GetComponent <Rigidbody>();
        rigid.angularDrag = 999;
        rigid.drag        = 4;
        rigid.constraints = RigidbodyConstraints.FreezeRotationX | RigidbodyConstraints.FreezeRotationZ;

        inventoryManager = GetComponent <InventoryManager>();
        inventoryManager.Init(this);

        actionManager = GetComponent <ActionManager>();
        actionManager.Init(this);

        a_hook = activeModel.GetComponent <AnimatorHook>();
        if (a_hook == null)
        {
            a_hook = activeModel.AddComponent <AnimatorHook>();
        }
        a_hook.Init(this, null);

        gameObject.layer = 8;
        ignoreLayers     = ~(1 << 9);

        anim.SetBool(StaticStrings.onGround, true);

        characterStats.InitCurrent();
        UIManager UI = UIManager.singleton;

        UI.AffectAll(characterStats.health, characterStats.focus, characterStats.stamina);
        UI.InitSouls(characterStats._souls);
    }
示例#2
0
    public void Init()
    {
        SetupAnimator();
        _rb             = GetComponent <Rigidbody>();
        _rb.angularDrag = 999;
        _rb.drag        = 4;
        _rb.constraints = RigidbodyConstraints.FreezeRotationX | RigidbodyConstraints.FreezeRotationZ;

        inventoryManager = GetComponent <InventoryManager>();
        inventoryManager.Init();

        actionManager = GetComponent <ActionManager>();
        actionManager.Init(this);

        a_hook = _activeModel.AddComponent <AnimatorHook>();
        a_hook.Init(this);

        weaponCollisions = GetComponentInChildren <WeaponCollisions>();
        weaponCollisions.Init(this);

        playerCollisions = GetComponent <PlayerCollisions>();
        playerCollisions.Init(this);

        Current_Health = Max_Health;

        flameParticles.Pause();


        gameObject.layer = 8;
        ignoreLayers     = ~(1 << 9);

        _anim.SetBool("OnGround", true);
    }
示例#3
0
    public void InitPlayerController()
    {
        resourcesManager = Resources.Load("Resources") as ResourcesManager;

        resourcesManager.InitResourcesManager();

        mTransform = this.transform;
        SetupAnimator();

        rigidBody             = GetComponent <Rigidbody>();
        rigidBody.isKinematic = false;
        rigidBody.drag        = 4;
        rigidBody.angularDrag = 999;
        rigidBody.constraints = RigidbodyConstraints.FreezeRotationX | RigidbodyConstraints.FreezeRotationY | RigidbodyConstraints.FreezeRotationZ;
        controllerCollider    = GetComponent <Collider>();

        ignoreLayer     = ~(1 << 9);
        ignoreForGround = ~(1 << 9 | 1 << 10);


        animatorHook = activeModel.AddComponent <AnimatorHook>();
        animatorHook.InitAnimatorHook(this);

        InitWeapon();

        healthPlayer = GetComponent <Health>();
        startHealth  = healthPlayer.healthAmount;
    }
    private void Awake()
    {
        Controller = new CharacterController(gameObject.AddComponent <Rigidbody>());
        Animator anim = transform.GetComponentInChildren <Animator>();

        animatorHook = anim.gameObject.AddComponent <AnimatorHook>();
        animatorHook.Init(anim, Controller);
        Init();
    }
    // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
    override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        if (hook == null)
        {
            hook = animator.GetComponent <AnimatorHook>();
        }

        hook.SetHold(true);
    }
示例#6
0
 private void OnTriggerEnter(Collider col)
 {
     if (col.tag == "Player")
     {
         state  = col.GetComponent <StateManager>();
         a_hook = state.transform.GetComponentInChildren <AnimatorHook>();
         if (state.perfectDodge && a_hook.rolling)
         {
             timeManager.SlowmotionSet(1f, 0.05f);
         }
     }
 }
示例#7
0
    public void Init()
    {
        SetupAnimator();
        rBody             = GetComponent <Rigidbody>();
        rBody.angularDrag = 999;
        rBody.drag        = 4;
        rBody.constraints = RigidbodyConstraints.FreezeRotationX | RigidbodyConstraints.FreezeRotationZ;
        a_hook            = activeModel.AddComponent <AnimatorHook>();
        a_hook.Init(this);

        gameObject.layer = 8;
        ignoreLayers     = ~(1 << 9);
    }
示例#8
0
    public void Init()
    {
        animator = model.GetComponent <Animator>();
        animator.applyRootMotion = false;
        rigid             = GetComponent <Rigidbody>();
        rigid.drag        = 4;
        rigid.constraints = RigidbodyConstraints.FreezeRotationX | RigidbodyConstraints.FreezeRotationZ | RigidbodyConstraints.FreezeRotationY;

        hook = model.AddComponent <AnimatorHook>();
        hook.Init(this);

        gameObject.layer = 8;
        ignoreLayers     = ~(1 << 9);
        animator.SetBool("onGround", true);
    }
示例#9
0
    void Start()
    {
        if (activeModel == null)
        {
            Debug.LogError("No active model assigned to the StateManager!");
        }

        animator        = activeModel.GetComponent <Animator>();
        inputController = GetComponent <InputController>();

        animatorHook = activeModel.AddComponent <AnimatorHook>();
        animatorHook.Init(this, GetComponent <Rigidbody>());

        animator.applyRootMotion = false;
    }
示例#10
0
    public void Init()
    {
        SetupAnimator();

        spawnProjectiles.Init(this);

        rb             = GetComponent <Rigidbody>();
        rb.angularDrag = 999;
        rb.drag        = 4;
        rb.constraints = RigidbodyConstraints.FreezeRotationX | RigidbodyConstraints.FreezeRotationZ;

        a_hook = activeModel.AddComponent <AnimatorHook>();
        a_hook.Init(this);

        //ignoreLayers = ~(1<<10);
        anim.SetBool("onGround", true);
    }
示例#11
0
    public void Init()
    {
        SetupAnimator();

        rb             = GetComponent <Rigidbody>();
        rb.angularDrag = 999;
        rb.drag        = 4;
        rb.constraints = RigidbodyConstraints.FreezeRotationX | RigidbodyConstraints.FreezeRotationZ;

        animHook = activeModel.AddComponent <AnimatorHook>();
        animHook.Init(this);

        gameObject.layer = 8;
        ignoredLayers    = ~(1 << 9);

        anim.SetBool("isGrounded", true);
    }
示例#12
0
 private void OnTriggerEnter(Collider col)
 {
     if (col.tag == "Player")
     {
         a_hook = state.transform.GetComponentInChildren <AnimatorHook>();
         if (skillManager.skill_DataBackup.canTrigger)
         {
             col.GetComponent <StateManager>().Skill_DataBackup();
         }
         if (state.perfectDodge && a_hook.rolling)
         {
             StartCoroutine(AIP.AddDodgeImage());
             StartCoroutine(Camera.main.GetComponent <CameraShaker>().CameraShakeOneShot(0.3f, 0.05f, 1.5f));
             state.model.SetActive(false);
             timeManager.SlowmotionSet(1f, 0.05f);
         }
     }
 }
示例#13
0
        private void Start()
        {
            health   = 100000;
            anim     = GetComponentInChildren <Animator>();
            enTarget = GetComponent <EnemyTarget>();
            enTarget.Init(this);

            rigid = GetComponent <Rigidbody>();

            a_hook = anim.GetComponent <AnimatorHook>();
            if (a_hook == null)
            {
                a_hook = anim.gameObject.AddComponent <AnimatorHook>();
            }
            a_hook.Init(null, this);

            InitRagdoll();
            parryIsOn = false;
        }
示例#14
0
    public void Init()
    {
        SetupAnimator();
        rigid             = GetComponent <Rigidbody>();
        rigid.drag        = 4;
        rigid.angularDrag = 999;
        rigid.constraints = RigidbodyConstraints.FreezeRotationX | RigidbodyConstraints.FreezeRotationZ;

        inventoryManager = GetComponent <InventoryManager>();
        inventoryManager.Init(this);

        actionManager = GetComponent <ActionManager>();
        actionManager.Init(this);

        animHook = activeModel.GetComponent <AnimatorHook>();

        if (animHook == null)
        {
            animHook = activeModel.AddComponent <AnimatorHook>();
        }

        animHook.Init(this, null);

        gameObject.layer     = 8;
        ignoreLayers         = ~(1 << 9);
        ignoreForGroundCheck = ~(1 << 9 | 1 << 10);

        animator.SetBool(StaticStrings.animParam_OnGround, true);

        pickableItemManager = GetComponent <PickableItemsManager>();

        UIManager UIManager = UIManager.Instance;

        characterStats.InitCurrent();
        UIManager.EffectAll(characterStats.hp, characterStats.fp, characterStats.stamina);
        UIManager.InitSouls(characterStats.currentSouls);

        prevGround = true;

        DialogueManager.Instance.Init(this.transform);
    }