Beispiel #1
0
 void Awake()
 {
     //these componenents are all located within this game object so i can just use getcomponent
     PlayerCam    = Camera.main;
     _GameState   = gameObject.GetComponent <GameState>();
     _Movement    = gameObject.GetComponent <Movement> ();
     _Zombies     = gameObject.GetComponent <Zombies> ();
     _ItemActions = gameObject.GetComponent <ItemActions> ();
 }
Beispiel #2
0
 private void OnEnable()
 {
     source         = (ItemActions)target;
     s_itemDatabase = serializedObject.FindProperty("itemDatabase");
     s_giveItem     = serializedObject.FindProperty("giveItem");
     s_yesActions   = serializedObject.FindProperty("yesActions");
     s_noActions    = serializedObject.FindProperty("noActions");
     s_amount       = serializedObject.FindProperty("amount");
 }
Beispiel #3
0
 public void DeactivateAllText()
 {
     lock (ItemActions)
     {
         ItemActions.Enqueue(new ItemAction()
         {
             Action = ItemAction.ActionTypeEnum.DeactivateAll, ItemType = ItemAction.ItemTypeEnum.Text
         });
     }
 }
Beispiel #4
0
 public void Deactivate(string id, ItemAction.ItemTypeEnum it)
 {
     lock (ItemActions)
     {
         ItemActions.Enqueue(new ItemAction()
         {
             Action = ItemAction.ActionTypeEnum.Deactivate, Id = id, ItemType = it
         });
     }
 }
Beispiel #5
0
 public void Activate(string id, ScarboroughItem si)
 {
     lock (ItemActions)
     {
         ItemActions.Enqueue(new ItemAction()
         {
             Action = ItemAction.ActionTypeEnum.Activate, Id = id, Item = si
         });
     }
 }
Beispiel #6
0
        /// <summary>
        /// Constructor of the Menu item.
        /// </summary>
        /// <param name="game">War game in which the item is used</param>
        /// <param name="_scene">Menu in which the item is used</param>
        /// <param name="_position">Position of the item</param>
        /// <param name="_label">Label of the item</param>
        /// <param name="_action">Action attached to this item</param>
        public MenuItem(WarGame game, MenuScene _scene, Vector2 _position, string _label, ItemActions _action)
            : base(game)
        {
            scene = _scene;
            Position = _position;
            label = _label;
            action = _action;

            DrawOrder = (int)WarGame.DrawingOrder.Sprite;
        }
        public override void OnEnter()
        {
            var go = Fsm.GetOwnerDefaultTarget(gameObject);

            theScript = go.GetComponent <ItemActions>();


            if (!everyFrame.Value)
            {
                DoTheMethod();
                Finish();
            }
        }
Beispiel #8
0
        /// <summary>
        /// 添加操作数据项
        /// 数据项的主键将用脚本参数 (默认 selectedId) 传递
        /// </summary>
        /// <param name="display">显示文字</param>
        /// <param name="script">脚本参数 (默认 selectedId)</param>
        /// <returns></returns>
        public IStaticTableItemAction <TModel> AddActionItem(string display, string script)
        {
            if (string.IsNullOrWhiteSpace(display))
            {
                throw new ArgumentNullException("display");
            }
            if (string.IsNullOrWhiteSpace(script))
            {
                throw new ArgumentNullException("script");
            }

            var action = new StaticTableAction <TModel>(display, script, LinkBehave.Script);

            ItemActions.Add(action);
            return(action);
        }
Beispiel #9
0
        /// <summary>
        /// 添加操作数据项
        /// 数据项的主键将用变量 (默认 selectedId) 传递
        /// </summary>
        /// <param name="location"></param>
        /// <returns></returns>
        public IStaticTableItemAction <TModel> AddActionItem(ILocation location)
        {
            if (location == null)
            {
                throw new ArgumentNullException("location");
            }
            if (location.Behave == LinkBehave.Script)
            {
                throw new ArgumentException("路径不能设置 LinkBehave.Script", "location.Behave");
            }

            var action = new StaticTableAction <TModel>(location.Display, location.Path, location.Behave);

            ItemActions.Add(action);
            return(action);
        }
Beispiel #10
0
 private void ExecuteActions()
 {
     lock (ItemActions)
     {
         while (ItemActions.Count > 0)
         {
             try
             {
                 ItemAction ia = ItemActions.Dequeue();
                 ExecuteAction(ia);
             }
             catch (Exception)
             {
             }
         }
     }
 }
Beispiel #11
0
 private void OnKeyRelease(ushort id)
 {
     ItemActions.OnRelease(id);
 }
Beispiel #12
0
 private void OnKeyHold(ushort id)
 {
     ItemActions.OnHold(id);
 }
Beispiel #13
0
 private void OnKeyPress(ushort id)
 {
     ItemActions.OnPress(id);
 }
Beispiel #14
0
    void Update()
    {
        if (Input.GetButton("Item1"))
        {
            if (itemState == ItemState.Item01)
            {
                //print ("Item1_Atack");
                ItemActions Item1Actions = Item01.GetComponent <ItemActions> ();
                Item1Actions.Activate();
            }
            else
            {
                itemState = ItemState.Item01;
            }
        }
        if (Input.GetButton("Item2"))
        {
            if (itemState == ItemState.Item02)
            {
                //print ("Item2_Atack");
            }
            else
            {
                itemState = ItemState.Item02;
            }
        }
        if (Input.GetAxisRaw("Item3") > 0.7)
        {
            if (itemState == ItemState.Item03)
            {
                //print ("Item3_Atack");
            }
            else
            {
                itemState = ItemState.Item03;
            }
        }
        if (Input.GetAxisRaw("Item3") < -0.7)
        {
            if (itemState == ItemState.Item04)
            {
                //print ("Item4_Atack");
            }
            else
            {
                itemState = ItemState.Item04;
            }
        }



        ItemLookdirection = this.GetComponent <CharContolerLogic_simple>().Head.transform.rotation;
        ItemLookIntensity = this.GetComponent <CharContolerLogic_simple>().LookdirectionOut.magnitude;

        rigthX = Input.GetAxisRaw("RightStickX");
        rigthY = Input.GetAxisRaw("RightStickY");

//		print ( "_Item01"+Item01.transform.localRotation+"_Item02"+Item01.transform.localRotation+"_Item03"+Item01.transform.localRotation+"_Item04"+Item01.transform.localRotation);


        //---
        switch (itemState)
        {
        case ItemState.Item01:
            //-
            Item01.transform.parent        = CharRightHand.transform;
            Item01.transform.localPosition = Vector3.zero;
            Item01.transform.localRotation = new Quaternion(0, 0, 0, 0);
            Item01.transform.localScale    = Vector3.one;
            Item01.GetComponentInChildren <Rigidbody>().detectCollisions = true;


            //-

            Item02.transform.parent        = ItemHolder02.transform;
            Item02.transform.localPosition = Vector3.zero;
            Item02.transform.localRotation = new Quaternion(0, 0, 0, 0);
            Item02.transform.localScale    = Vector3.one;
            Item02.GetComponentInChildren <Rigidbody>().detectCollisions = false;


            Item03.transform.parent        = ItemHolder03.transform;
            Item03.transform.localPosition = Vector3.zero;
            Item03.transform.localRotation = new Quaternion(0, 0, 0, 0);
            Item03.transform.localScale    = Vector3.one;
            Item03.GetComponentInChildren <Rigidbody>().detectCollisions = false;

            Item04.transform.parent        = ItemHolder04.transform;
            Item04.transform.localPosition = Vector3.zero;
            Item04.transform.localRotation = new Quaternion(0, 0, 0, 0);
            Item04.transform.localScale    = Vector3.one;
            Item04.GetComponentInChildren <Rigidbody>().detectCollisions = false;

            CharRightHandIdleRot = new Quaternion(-0.4f, 0, 0, 1);
            break;

        case ItemState.Item02:

            Item01.transform.parent        = ItemHolder01.transform;
            Item01.transform.localPosition = Vector3.zero;
            Item01.transform.localRotation = new Quaternion(0, 0, 0, 0);
            Item01.transform.localScale    = Vector3.one;
            Item01.GetComponentInChildren <Rigidbody>().detectCollisions = false;

            //-
            Item02.transform.parent        = CharRightHand.transform;
            Item02.transform.localPosition = Vector3.zero;
            Item02.transform.localRotation = new Quaternion(0, 0, 0, 0);
            Item02.transform.localScale    = Vector3.one;
            Item02.GetComponentInChildren <Rigidbody>().detectCollisions = true;
            //-

            Item03.transform.parent        = ItemHolder03.transform;
            Item03.transform.localPosition = Vector3.zero;
            Item03.transform.localRotation = new Quaternion(0, 0, 0, 0);
            Item03.transform.localScale    = Vector3.one;
            Item03.GetComponentInChildren <Rigidbody>().detectCollisions = false;

            Item04.transform.parent        = ItemHolder04.transform;
            Item04.transform.localPosition = Vector3.zero;
            Item04.transform.localRotation = new Quaternion(0, 0, 0, 0);
            Item04.transform.localScale    = Vector3.one;
            Item04.GetComponentInChildren <Rigidbody>().detectCollisions = false;

            CharRightHandIdleRot = new Quaternion(0.4f, 0, 0, 1);
            break;

        case ItemState.Item03:

            Item01.transform.parent        = ItemHolder01.transform;
            Item01.transform.localPosition = Vector3.zero;
            Item01.transform.localRotation = new Quaternion(0, 0, 0, 0);
            Item01.transform.localScale    = Vector3.one;
            Item01.GetComponentInChildren <Rigidbody>().detectCollisions = false;

            Item02.transform.parent        = ItemHolder02.transform;
            Item02.transform.localPosition = Vector3.zero;
            Item02.transform.localRotation = new Quaternion(0, 0, 0, 0);
            Item02.transform.localScale    = Vector3.one;
            Item02.GetComponentInChildren <Rigidbody>().detectCollisions = false;

            //-
            Item03.transform.parent        = CharRightHand.transform;
            Item03.transform.localPosition = Vector3.zero;
            Item03.transform.localRotation = new Quaternion(0, 0, 0, 0);
            Item03.transform.localScale    = Vector3.one;
            Item03.GetComponentInChildren <Rigidbody>().detectCollisions = true;
            //-

            Item04.transform.parent        = ItemHolder04.transform;
            Item04.transform.localPosition = Vector3.zero;
            Item04.transform.localRotation = new Quaternion(0, 0, 0, 0);
            Item04.transform.localScale    = Vector3.one;
            Item04.GetComponentInChildren <Rigidbody>().detectCollisions = false;

            CharRightHandIdleRot = new Quaternion(0.7f, 0.7f, 0.7f, 0.7f);
            break;

        case ItemState.Item04:


            Item01.transform.parent        = ItemHolder01.transform;
            Item01.transform.localPosition = Vector3.zero;
            Item01.transform.localRotation = new Quaternion(0, 0, 0, 0);
            Item01.transform.localScale    = Vector3.one;
            Item01.GetComponentInChildren <Rigidbody>().detectCollisions = false;

            Item02.transform.parent        = ItemHolder02.transform;
            Item02.transform.localPosition = Vector3.zero;
            Item02.transform.localRotation = new Quaternion(0, 0, 0, 0);
            Item02.transform.localScale    = Vector3.one;
            Item02.GetComponentInChildren <Rigidbody>().detectCollisions = false;

            Item03.transform.parent        = ItemHolder03.transform;
            Item03.transform.localPosition = Vector3.zero;
            Item03.transform.localRotation = new Quaternion(0, 0, 0, 0);
            Item03.transform.localScale    = Vector3.one;
            Item03.GetComponentInChildren <Rigidbody>().detectCollisions = false;

            //-
            Item04.transform.parent        = CharRightHand.transform;
            Item04.transform.localPosition = Vector3.zero;
            Item04.transform.localRotation = new Quaternion(0, 0, 0, 0);
            Item04.transform.localScale    = Vector3.one;
            Item04.GetComponentInChildren <Rigidbody>().detectCollisions = true;
            //-

            CharRightHandIdleRot = new Quaternion(-0.3f, 0, 0, 1);
            break;
        }

        //---

        if (rigthY == 0 && rigthX == 0)
        {
            CharRightHand.transform.parent = this.transform;

            //	CharRightHand.transform.localPosition = Vector3.Lerp(CharRightHand.transform.localPosition,CharRightHandIdlePos, 1f );
            CharRightHand.transform.localRotation = Quaternion.Slerp(CharRightHand.transform.rotation, CharRightHandIdleRot, 1f);
        }
        else
        {
            CharRightHand.transform.parent = this.GetComponent <CharContolerLogic_simple>().Head.transform;

            //print (Mathf.Min(1,ItemLookIntensity));
            CharRightHand.transform.localPosition = new Vector3((1 - ItemLookIntensity) * 0.3f, (-0.05f - CharRightHandIdlePos.y + (ItemLookIntensity * 0.05f)), Mathf.Min(1, (ItemLookIntensity) + 0.5f));

            CharRightHand.transform.rotation = Quaternion.Slerp(CharRightHand.transform.rotation, ItemLookdirection, 0.3f);
        }
    }
Beispiel #15
0
 public void Start()
 {
     _ItemActions   = GameObject.Find("GameFlow").GetComponent <ItemActions> ();
     _GameState     = GameObject.Find("GameFlow").GetComponent <GameState> ();
     _PlayerControl = GameObject.Find("GameFlow").GetComponent <PlayerControl> ();
 }
Beispiel #16
0
 private void Awake()
 {
     instance = this;
 }