public void setActions(List <Action> actions, IActionReceiver receiver = null)
 {
     this.actions  = actions;
     this.quadrant = getQuadrant();
     this.receiver = receiver;
     regenerate();
 }
Ejemplo n.º 2
0
    public virtual void Setup(BaseCreature creatureData)
    {
        data           = creatureData;
        data.currentHp = data.hp;
        rb             = GetComponent <Rigidbody2D>();
        rb.angularDrag = data.angularDrag;
        rb.drag        = data.drag;
        rb.mass        = data.mass;
        var coll = GetComponent <Collider2D>();
        var mat  = new PhysicsMaterial2D();

        mat.bounciness       = data.bounciness;
        mat.friction         = data.friction;
        coll.sharedMaterial  = mat;
        transform.localScale = Vector3.one * creatureData.scale;
        view.sprite          = SpriteBase.GetSprite(data.view + data.teamId);
        teamId = data.teamId;
        progressBar.gameObject.SetActive(true);
        if (data.Action != null)
        {
            actionReceiver = gameObject.AddComponent(data.Action.GetType()) as IActionReceiver;
            actionReceiver.Setup(data.Action as IActionReceiver);
        }

        if (data.HitAction != null)
        {
            hitActionReceiver = gameObject.AddComponent(data.HitAction.GetType()) as IActionReceiver;
            hitActionReceiver.Setup(data.HitAction as IActionReceiver);
        }

        MatchManager.OnEndTurn += OnEndTurn;
    }
Ejemplo n.º 3
0
        public void setAction(Action action, IActionReceiver actionReceiver = null)
        {
            var buttonMB = this.button.GetComponent <ButtonMB>();

            buttonMB.Action   = action;
            buttonMB.Receiver = actionReceiver;
        }
Ejemplo n.º 4
0
    public void Setup(IActionReceiver other)
    {
        var pref = other as RailShot;

        width      = pref.width;
        affectType = pref.affectType;
        damage     = pref.damage;
    }
Ejemplo n.º 5
0
    public void Setup(IActionReceiver other)
    {
        var pref = other as Shield;

        radius            = pref.radius;
        shield            = pref.shield;
        force             = pref.force;
        liveLengthInTurns = pref.liveLengthInTurns;
    }
Ejemplo n.º 6
0
    public void Setup(IActionReceiver other)
    {
        var pref = other as AreaDamage;

        affectType = pref.affectType;
        radius     = pref.radius;
        damage     = pref.damage;
        force      = pref.force;
    }
Ejemplo n.º 7
0
    public void Setup(IActionReceiver other)
    {
        var pref = other as Shoot;

        quanity      = pref.quanity;
        coneAngle    = pref.coneAngle;
        bolid        = pref.bolid;
        bolid.teamId = GetComponent <Creature>().data.teamId;
    }
Ejemplo n.º 8
0
 public void Setup(BaseSpell data)
 {
     if (data.Action != null)
     {
         actionReceiver = gameObject.AddComponent(data.Action.GetType()) as IActionReceiver;
         actionReceiver.Setup(data.Action as IActionReceiver);
         actionReceiver.Action(transform.position, 0f);
     }
 }
Ejemplo n.º 9
0
        //#################################################################
        //#################################################################
        //#################################################################
        #region Misc
        public void showActions(List <Action> actions, Vector2 position, IActionReceiver actionReceiver = null)
        {
            Vector3 pos      = Camera.main.ScreenToWorldPoint(Input.mousePosition);
            var     mouseRay = Camera.main.ScreenPointToRay(Input.mousePosition);

            MenuMB.Instance.transform.position = new Vector3(pos.x, pos.y, pos.z) + mouseRay.direction.normalized * 10;
            MenuMB.Instance.transform.rotation = Camera.main.transform.rotation;
            MenuMB.Instance.setActions(actions, actionReceiver);
            MenuMB.Instance.show();
            // TODO why isnt position used?
            //this.clicked_on = position;
        }
Ejemplo n.º 10
0
    public void Setup(IActionReceiver other)
    {
        var pref = other as AreaBuff;

        radius     = pref.radius;
        affectType = pref.affectType;
        modifiers  = new PropertyModifier[pref.modifiers.Length];
        for (int i = 0; i < pref.modifiers.Length; i++)
        {
            modifiers[i] = pref.modifiers[i].Clone();
        }
    }
Ejemplo n.º 11
0
		public GameAction(ActionType actionType, IActionReceiver actionReceiver)
		{
			this.ActionReceiver = actionReceiver;
			this.ActionType = actionType;
		}
Ejemplo n.º 12
0
 public void Setup(IActionReceiver other)
 {
 }
		public virtual IGameAction GetAction(ActionType actionType, IActionReceiver actionReceiver)
		{
			var action = new KeyValuePair<ActionType, IActionReceiver>(actionType, actionReceiver);
			return _ActionsCache.GetOrAdd(action, this.CreateAction);
		}
		public DefaultGameAction(ActionType actionType, IActionReceiver actionReceiver)
			: base(actionType, actionReceiver)
		{
		}