Пример #1
0
 // Use this for initialization
 void Start()
 {
     m_PlayerInput      = GetComponent <PlayerInput>();
     m_PlayerController = GetComponent <PlayerController>();
     animator           = GetComponent <Animator>();
     m_animatorManeger  = new AnimatorManager(GetComponentsInChildren <Animator>(true));
 }
Пример #2
0
 private void Awake()
 {
     UIPoint   = transform.Find("UIPoint");
     FirePoint = transform.Find("FirePoint");
     animation = transform.GetComponentInChildren <Animator>().gameObject.AddComponent <AnimatorManager>();
     weapot    = GetComponent <UnitWeapot>();
 }
Пример #3
0
 private void Awake()
 {
     inputManager    = GetComponent <InputManager>();
     animatorManager = GetComponent <AnimatorManager>();
     playerRb        = GetComponent <Rigidbody>();
     cameraObject    = Camera.main.transform;
 }
        public override void Initialize(ThirdPersonSystem mainSystem, AnimatorManager animatorManager, UnityInputManager inputManager)
        {
            base.Initialize(mainSystem, animatorManager, inputManager);

            m_ClimbJump = m_System.CharacterAbilities.Find(x => x is ClimbJump) as ClimbJump;
            m_WallRun   = m_System.CharacterAbilities.Find(x => x is WallRun) as WallRun;
        }
Пример #5
0
 void Start()
 {
     animator_Manager = myBody.GetComponent <AnimatorManager>(); // Acive animations
     _soldiersManager = soldiersManagerGO.GetComponent <soldiersManager>();
     Health           = 100;
     bullet           = GameObject.Find("BulletM4a1");
 }
Пример #6
0
 private void Awake()
 {
     if (!instance)
     {
         instance = this;
     }
 }
Пример #7
0
 private void Awake()
 {
     inputManager     = GetComponent <InputManager>();
     animatorManager  = GetComponentInChildren <AnimatorManager>();
     cameraManager    = FindObjectOfType <CameraManager>();
     playerLocomotion = GetComponent <PlayerLocomotion>();
     playerAttacker   = GetComponent <PlayerAttacker>();
 }
Пример #8
0
 void Awake()
 {
     m_runnerController = GetComponent <RunnerController>();
     m_runnerInput      = GetComponent <RunnerInput>();
     m_status           = GetComponent <RunnerStatus>();
     m_runnerSkill      = GetComponent <RunnerSkill>();
     m_animatorManeger  = new AnimatorManager(GetComponentsInChildren <Animator>(true));
 }
Пример #9
0
        public virtual void Initialize(ThirdPersonSystem mainSystem, AnimatorManager animatorManager, UnityInputManager inputManager)
        {
            m_System          = mainSystem;
            m_AnimatorManager = animatorManager;
            m_InputManager    = inputManager;

            m_InputToEnter = m_InputManager.GetInputReference(InputButton);
        }
Пример #10
0
 private void Awake()
 {
     Instance = this;
     //事件方法注册
     buttonRelect.onClick.AddListener(OnReSelctClick);
     buttonDontReslect.onClick.AddListener(OnDontReselcetClick);
     Dropdown_SelectQuestion.onValueChanged.AddListener(OnSelectQuestionChanged);
     animatorManager = AnimatorManager.Instance;
 }
Пример #11
0
    internal void Init(PlayerInfo playerInfo)
    {
        this.playerInfo = playerInfo;
        //英雄是不是自己的角色
        isSelf = PlayerModel.Instance.CheckIsSelf(playerInfo.RolesInfo.RolesID);

        //复活的时候 会用到
        spawnPosition = transform.position;
        spawnRotaiton = transform.eulerAngles;

        //获取它的属性 当前的属性 还有总的属性
        currenAttribute = HeroAttributeConfig.GetInstance(playerInfo.HeroID);
        totalAttribute  = HeroAttributeConfig.GetInstance(playerInfo.HeroID);

        RoomModel.Instance.SaveHeroAttribute(playerInfo.RolesInfo.RolesID, currenAttribute, totalAttribute);

        //人物的HUD 血条 蓝条 昵称 等级
        HUD = ResManager.Instance.LoadHUD();
        HUD.transform.position    = transform.position + hudOffset;
        HUD.transform.eulerAngles = Camera.main.transform.eulerAngles;

        HPFill = HUD.transform.Find("HP/Fill").GetComponent <Image>();
        MPFill = HUD.transform.Find("MP/Fill").GetComponent <Image>();

        HPText       = HUD.transform.Find("HP/Text").GetComponent <Text>();
        MPText       = HUD.transform.Find("MP/Text").GetComponent <Text>();
        NickNameText = HUD.transform.Find("NickName").GetComponent <Text>();
        LevelText    = HUD.transform.Find("Level/Text").GetComponent <Text>();
        HUDUpdate(true);


        //技能管理器
        skillManager = this.gameObject.AddComponent <SkillManager>();
        skillManager.Init(this);

        //动画管理器
        animatorManager = this.gameObject.AddComponent <AnimatorManager>();
        animatorManager.Init(this);

        //角色的状态机 FSM
        playerFSM = this.gameObject.AddComponent <PlayerFSM>();
        playerFSM.Init(this);


        //相机的跟随->相机的脚本里去做
        if (isSelf == true)
        {
            if (playerInfo.TeamID == 0)
            {
                Camera.main.transform.eulerAngles = new Vector3(45, 180, 0);
            }
            else
            {
                Camera.main.transform.eulerAngles = new Vector3(45, -180, 0);
            }
        }
    }
Пример #12
0
    /*A function that determines the context of a click given the name of the item clicked on.*/
    private void ParseItemClicks(string name)
    {
        //first, get the Item
        Item itemClicked = new Item();

        itemClicked = FindItemByName(name);

        //find all game objects of type Person in the scene and set their animations to idle
        GameObject[] people = GameObject.FindGameObjectsWithTag("Person");
        for (int i = 0; i < people.Length; i++)
        {
            AnimatorManager am = people[i].GetComponent <AnimatorManager>();
            am.ResetToIdle();
        }

        //if the player is attempting to look at an item
        if (GameManager.currentAction == 2)
        {
            //update the dialogue box with the item's description
            GameManager.UpdateDialogueText(itemClicked.ItemDescription);
        }
        //if the player is attempting to talk to an item
        else if (GameManager.currentAction == 3)
        {
            if (GameManager.levelIndex == 0)
            {
                //dont let them
                GameManager.UpdateDialogueText("You can't talk to this.");
            }
        }
        //if the player is attempting to pick up an item
        else if (GameManager.currentAction == 4)
        {
            //find the gameobject to be removed from the scene
            GameObject objectToBeDestroyed = GameObject.Find(name);

            //reflect that they picked the item up in the dialogue box
            GameManager.UpdateDialogueText("You picked up: " + name);
            //add the item to the player's inventory
            GameManager.inventory.Add(itemClicked);
            Debug.Log("Added " + itemClicked.ItemName + " to inventory");
            GameManager.UpdateInventory(objectToBeDestroyed.GetComponent <Image>().sprite);
            //destroy the gameobject pertaining to the Item
            Destroy(GameObject.Find(name));
            //reset the action text window
            GameManager.UpdateActionText(" ");

            GameManager.ChangeCurrentAction(2);
        }

        //if the player isnt trying to pick up an item, they're probably trying to look at it
        if (GameManager.currentAction != 4)
        {
            //so give the description
            GameManager.UpdateDialogueText(itemClicked.ItemDescription);
        }
    }
Пример #13
0
 void Start()
 {
     animatorManager = GetComponentInChildren <AnimatorManager>();
     hpMax           = SetMaxHealth();
     hpCurrent       = hpMax;
     hpBar.size      = hpCurrent / 100;
     hpPanel.CrossFadeAlpha((hpMax - hpCurrent) / 100, 0.1f, false);
     SetPanelFade();
 }
Пример #14
0
 public GroundMovement(Transform transform, CharacterController characterController, Camera camera,
                       AnimatorManager animatorManager, float speed)
 {
     this.characterController = characterController;
     this.speed           = speed;
     this.camera          = camera;
     this.transform       = transform;
     this.animatorManager = animatorManager;
 }
    private void Awake()
    {
        playerManager   = GetComponent <PlayerManager>();
        animatorManager = GetComponentInChildren <AnimatorManager>();
        inputManager    = GetComponent <InputManager>();

        rb = GetComponent <Rigidbody>();

        cameraObject = Camera.main.transform;
    }
Пример #16
0
    void Awake()
    {
        textManager     = GetComponent <TextManager>();
        animatorManager = GetComponent <AnimatorManager>();
        branches        = StoryBranches.storyBranches;

        startPos = pos;

        SetUpStory();
    }
Пример #17
0
 /// <summary>
 /// Sets the background and calls the load_coach method.
 /// </summary>
 private void on_load()
 {
     _animatorManager   = AnimatorManager.Instance;
     BackgroundHolder   = GameObject.Find("background");
     _backgroundSprite  = BackgroundHolder.GetComponent <SpriteRenderer>();
     _backgroundTexture = Resources.LoadAll <Sprite>("Textures");
     _backgroundNumber  = 2;
     load_background();
     _coachNumber = 5;
     load_coach();
 }
Пример #18
0
 /// <summary>
 /// 建構子
 /// </summary>
 /// <param name="abilities">代理具有的能力</param>
 /// <param name="animator">代理的Animator</param>
 public AbilityManager(AbilityBase[] abilities, Animator animator)
 {
     Array.Sort(abilities, (AbilityBase x, AbilityBase y) => y.Priority.CompareTo(x.Priority));
     Abilities      = new LinkedList <AbilityBase>(abilities);
     CurrentAbility = Abilities.Last.Value;
     if (animator != null)
     {
         _animatorManager          = animator;
         _animatorManager.AnimClip = (int)CurrentAbility.AnimClip;
     }
 }
Пример #19
0
    public bool Hijack_Frag;          //乗っ取られているか否か

    void Start()
    {
        rb = GetComponent <Rigidbody2D>();
        m_playerAnimations = GetComponent <PlayerAnimations>();
        m_animatorManeger  = new AnimatorManager(GetComponentsInChildren <Animator>(true));

        LaterChance_count = 0;
        State             = 0;
        Range_Flag1       = false;
        Range_Flag2       = false;
    }
Пример #20
0
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     animatorManager = GetComponent <AnimatorManager>();
     playerMovement  = GetComponent <PlayerMovement>();
     playerAttacker  = GetComponent <PlayerAttacker>();
     playerInventory = GetComponent <PlayerInventory>();
 }
Пример #21
0
    public override void RespondToChoice()
    {
        itemButtonHolder = GameObject.Find("Item_Button_Holder");

        //change current action
        GameManager.ChangeCurrentAction(0);

        //update action text
        GameManager.UpdateActionText(GameManager.verbs[0].actionText);
        //update dialogue text
        GameManager.UpdateDialogueText("Give which item?");

        //change status of itemclickhandler isGiving to true
        ItemClickHandler.isGiving = true;

        itemsForDestruction = GameObject.FindGameObjectsWithTag("Destroy");
        DestroyButtons();

        foreach (Item item in GameManager.inventory)
        {
            Button objectToBeInstantiated;
            Text   buttonText;

            objectToBeInstantiated = Instantiate(itemButton, itemButtonHolder.transform.position, Quaternion.identity);
            objectToBeInstantiated.transform.parent     = itemButtonHolder.transform;
            objectToBeInstantiated.transform.localScale = Vector3.one;

            Color c;
            c   = objectToBeInstantiated.GetComponent <Image>().color;
            c.a = 0;
            objectToBeInstantiated.GetComponent <Image>().color = c;

            buttonText      = objectToBeInstantiated.GetComponentInChildren <Text>();
            buttonText.text = item.ItemName;

            AnimatorManager am = GameObject.FindGameObjectWithTag("Wilson").GetComponent <AnimatorManager>();
            objectToBeInstantiated.onClick.AddListener(() => am.Talk());
            objectToBeInstantiated.onClick.AddListener(() => GameManager.inventory.Remove(item));
            objectToBeInstantiated.onClick.AddListener(() => Debug.Log(GameManager.inventory.Count));
            objectToBeInstantiated.onClick.AddListener(() => GameManager.UpdateDialogueText(item.ValidGive));
            objectToBeInstantiated.onClick.AddListener(() => itemsForDestruction = GameObject.FindGameObjectsWithTag("Destroy"));
            objectToBeInstantiated.onClick.AddListener(() => DestroyButtons());
        }

        //give item from inventory to person
        //1. get what item is selected
        //2. remove it from inventory
        //3. if target is not wilson -- return
    }
Пример #22
0
 // Use this for initialization
 private void Start()
 {
     c_transform  = GetComponent <Transform>();
     c_gameObject = GetComponent <GameObject>();
     health       = GetComponent <HasHealth>();
     unitAnimator = GetComponent <AnimatorManager>();
     if (health == null)
     {
         Debugger.printErrorLog("'" + name + "(" + entityType + ")' doesn't have a <HasHealth> COMPONENT.");
     }
     if (unitAnimator == null)
     {
         Debugger.printErrorLog("'" + name + "' doesn't have a <AnimatorManager(Script)> COMPONENT.");
     }
 }
Пример #23
0
    private void Awake()
    {
        buttonSubmit = transform.Find("Button_Submit").GetComponent <Button>();
        //将子物体的所有Toggle添加到toggleList中
        for (int i = 0; i < transform.childCount; i++)
        {
            Transform child = transform.GetChild(i);
            if (child.GetComponent <Toggle>() != null)
            {
                toggleList.Add(child.GetComponent <Toggle>());
            }
        }
        buttonSubmit.onClick.AddListener(OnclickSubmit);

        animatorManager = AnimatorManager.Instance;
    }
Пример #24
0
    public static float Update(AnimatorManager animatorManager, float timeOutTimer, float timeOut, GameObject newCoach)
    {
        // Handles what happens when the mouse hovers above the screen when TimeOut.
        var newTimeOutTimer = Refresh(animatorManager, timeOutTimer);

        // If timer reaches zero, do something as a timeout.
        TimeOutFunctionality(timeOutTimer, timeOut);

        // Handle button input
        HandleInput(animatorManager);

        // Controlling the avatar
        CharacterMovement(animatorManager, newCoach);

        return(newTimeOutTimer);
    }
Пример #25
0
        void Start()
        {
            //power = minPower;
            animatorManager = GetComponent <AnimatorManager>();
            grabber         = GetComponent <Grabber>();
            rb = GetComponent <Rigidbody2D>();
            gm = FindObjectOfType <GameManager>();

            if (!isLeftPlayer)
            {
                rb.AddForce(new Vector2(transform.position.x + 8, transform.position.y + 8) * 250);
            }
            else
            {
                rb.AddForce(new Vector2(transform.position.x - 8, transform.position.y + 8) * 250);
            }
        }
Пример #26
0
    void Start()
    {
        startpos         = transform.position;
        _Cam             = GameObject.Find("Main Camera").transform;
        body             = transform.GetComponent <Rigidbody2D>();
        _AnimatorManager = GetComponentInChildren <AnimatorManager>();
        _SpriteRenderer  = GetComponentInChildren <SpriteRenderer>();
        HealthPoint      = GameObject.FindGameObjectWithTag("MyHealth").transform;
        _AnimatorManager.Animator.speed = 1;
        test1 = _Cam.GetComponent <AudioSource>();
        _AnimatorManager.InAir(true);
        _AnimatorManager.Falling(true);

        _Gravydirection = Vector3.left;
        UpVector        = Vector3.right;
        startrotation   = transform.rotation;
    }
Пример #27
0
    private static void CharacterMovement(AnimatorManager animatorManager, GameObject newCoach)
    {
        var x = Input.GetAxis("Horizontal") * Time.deltaTime * 150.0f;
        var z = Input.GetAxis("Vertical") * Time.deltaTime * 100.0f;

        // Run if holding left shift, else walk
        if (Input.GetKey(KeyCode.LeftShift) && z > 0f)
        {
            animatorManager.SetBoolAnimator("run", true);
            animatorManager.SetBoolAnimator("walk", false);
            z *= 3f;
        }
        else
        {
            animatorManager.SetBoolAnimator("run", false);
            animatorManager.SetBoolAnimator("walk", z > 0f);
        }

        newCoach.transform.Rotate(0f, x, 0f);
        newCoach.transform.Translate(0f, 0f, z);
    }
Пример #28
0
    private static float Refresh(AnimatorManager animatorManager, float timeOutTimer)
    {
        const float epsilon = 0.0001f;

        if (!Input.anyKeyDown && Math.Abs(Input.GetAxis("Mouse X")) < epsilon && Math.Abs(Input.GetAxis("Mouse Y")) < epsilon &&
            !animatorManager.GetBoolAnimator("talk"))
        {
            return(timeOutTimer);
        }
        // If the user is active but the state is still in timeout, walk back in screen.
        if (animatorManager.GetBoolAnimator("timeout"))
        {
            animatorManager.SetBoolAnimator("timeout", false);
            // Do something on activation after timeout, may be inserted later
        }
        // Allow for moving the avatar with controls instead of only with animations.
        if (!animatorManager.GetApplyRootMotionAnimator() &&
            animatorManager.GetCurrentAnimatorStateInfoAnimator(0).IsName("idle"))
        {
            animatorManager.SetApplyRootMotionAnimator(true);
        }

        return(0f);
    }
Пример #29
0
    public bool enemyDead;            // indica morte no lifeManager;

    // lifeManager _lifeManger;
    void Start()
    {
        // bool controls
        enemyDead           = false;
        externalControl     = false;
        lookAtTrigger       = false;
        shootTriggerManager = false;
        scapeTrigger        = false;
        endScape            = false;

        // getting components
        animator_Manager = soldierGO.GetComponent <AnimatorManager>(); // Acive animations
        detection        = soldierGO.GetComponent <DetectTarget>();    // Recebe componente RayCast

        //_lifeManger = soldierGO.GetComponent<lifeManager>();

        // settings to scape
        startTime     = Time.time;                                                                // Keep a note of the time the movement started (scape function)
        journeyLength = Vector3.Distance(soldierGO.transform.position, scape.transform.position); // Calculate the journey length

        captTarget           = GameObject.Find("Player");
        enemyTarget          = captTarget.gameObject;
        detection.enemiesTag = enemyTarget.tag; // passa a tag do GameObject enemyTarget para a string "enemiesTag" do script DetectTarget
    }
Пример #30
0
 private void Awake()
 {
     animatorManager = GetComponent <AnimatorManager>();
 }
Пример #31
0
 void Awake()
 {
     _instance = this;
     Init();
     InitEvent();
 }