Example #1
0
        internal BreakEvent(XmlElement elem)
        {
            string s = elem.GetAttribute("enabled");

            if (s.Length > 0)
            {
                enabled = bool.Parse(s);
            }
            s = elem.GetAttribute("hitAction");
            if (s.Length > 0)
            {
                hitAction = (HitAction)Enum.Parse(typeof(HitAction), s);
            }
            s = elem.GetAttribute("customActionId");
            if (s.Length > 0)
            {
                customActionId = s;
            }
            s = elem.GetAttribute("traceExpression");
            if (s.Length > 0)
            {
                traceExpression = s;
            }
            s = elem.GetAttribute("hitCount");
            if (s.Length > 0)
            {
                hitCount = int.Parse(s);
            }
        }
Example #2
0
    public AnimeAction CreateHitDamageAction(BattleModel targetModel, AnimationClip hitEffect = null)
    {
        SequenceAction sequence = new SequenceAction();

        sequence.name = "HitSequence";

        if (hitEffect != null)
        {
            SimpleAnimationAction effectAction = new SimpleAnimationAction();
            effectAction.clip          = slashEffect;
            effectAction.spawnPosition = targetModel.transform.position + new Vector3(0, 1, -2);
            sequence.AddAction(effectAction);
        }

        HitAction hitAction = new HitAction();

        hitAction.name  = "enemyHit";
        hitAction.actor = targetModel;
        sequence.AddAction(hitAction);


        HitValueAction damageAction = new HitValueAction();

        damageAction.valueTextPrefab = hitValuePrefab;
        damageAction.hitValue        = 1000;
        damageAction.position        = targetModel.transform.position + new Vector3(0, 2, -2);
        sequence.AddAction(damageAction);

        return(sequence);
    }
Example #3
0
 /// <summary>
 /// Makes a copy of this instance
 /// </summary>
 /// <param name='ev'>
 /// A break event from which to copy the data.
 /// </param>
 public virtual void CopyFrom(BreakEvent ev)
 {
     hitAction       = ev.hitAction;
     customActionId  = ev.customActionId;
     traceExpression = ev.traceExpression;
     hitCount        = ev.hitCount;
 }
Example #4
0
    // Use this for initialization
    public void Create(HitAction onHit, Player source, Vector3 location, float size, float duration, float hitCooldown, List <Collider> ignoreCollision = null)
    {
        if (!defaultMaterial.ContainsKey(type))
        {
            defaultMaterial.Add(type, renderer[0].sharedMaterial);
        }

        if (!ActiveSource.ContainsKey(source))
        {
            CooldownQueue.Add(source, new Queue <CooldownObject>());
            CooldownSet.Add(source, new HashSet <GameObject>());
            ActiveSource.Add(source, 0);
        }
        RaycastHit hit;

        if (!Physics.Raycast(location + Vector3.up * 0.25f, Physics.gravity, out hit, 1.25f, GroundMask, QueryTriggerInteraction.Ignore))
        {
            return;
        }
        location = hit.point;

        GroundEffect newInstance;

        if (ObjectPool.Count > 0)
        {
            newInstance = ObjectPool.Dequeue();
            newInstance.gameObject.SetActive(true);
            newInstance.hitBox.enabled     = true;
            newInstance.transform.position = location;
        }
        else
        {
            if (parent == null)
            {
                parent = new GameObject("BurningGroundObjects").transform;
                //parent.SetParent(GameManager.instance.PersistBetweenRounds);
            }
            newInstance = Instantiate <GameObject>(gameObject, location, Quaternion.identity, parent).GetComponent <GroundEffect>();
        }
        ++ActiveSource[source];
        newInstance.gameObject.SetActive(true);
        newInstance.hitBox.enabled = true;
        newInstance.StartCoroutine(newInstance.StartAnimation(size, 0.25f));
        foreach (Renderer r in newInstance.renderer)
        {
            r.sharedMaterial = materialPerPlayer[source.colorIndex];
        }
        newInstance.OnHit           = onHit;
        newInstance.Source          = source;
        newInstance.HitCooldown     = hitCooldown;
        newInstance.IgnoreCollision = ignoreCollision;
        //if (ignoreCollision != null) {
        //    foreach (Collider c in ignoreCollision)
        //        if (c != null)
        //            Physics.IgnoreCollision(c, newInstance.hitBox);
        //}

        newInstance.endTime = Time.time + duration;
    }
 /// <summary>
 /// Makes a copy of this instance
 /// </summary>
 /// <param name='ev'>
 /// A break event from which to copy the data.
 /// </param>
 public virtual void CopyFrom(BreakEvent ev)
 {
     hitAction               = ev.hitAction;
     customActionId          = ev.customActionId;
     traceExpression         = ev.traceExpression;
     hitCount                = ev.hitCount;
     breakIfConditionChanges = ev.breakIfConditionChanges;
     conditionExpression     = ev.conditionExpression;
 }
    public AnimeAction CreateHitAction(BattleModel targetModel)
    {
        HitAction action = new HitAction();

        action.actor = targetModel;

        return(action);
        // SimpleAnimationAction effectAction = new SimpleAnimationAction();
        // effectAction.clip = hitEffect;
        // effectAction.spawnPosition = targetModel.transform.position  + new Vector3(0, 1, -2);
    }
Example #7
0
 protected override void BeginTurn()
 {
     if (Model.Score < maxHitValue.Value)
     {
         var hitAction = new HitAction(Model);
         ActionSystem.Instance.PerformAction(hitAction);
     }
     else
     {
         var stayAction = new StayAction(Model);
         ActionSystem.Instance.PerformAction(stayAction);
     }
 }
Example #8
0
        /// <summary>
        /// Checks to see if the arrow has hit something.
        /// </summary>
        /// <param name="data">The hit data.</param>
        public virtual void CheckHit(CollisionNotifier.EventData data)
        {
            int ignoreLayer = LayerMask.GetMask("Ignore Raycast");

            if (!inFlight ||
                data.ColliderData.attachedRigidbody == ArrowInteractable.InteractableRigidbody ||
                ignoreLayer == (ignoreLayer | (1 << data.ColliderData.gameObject.layer)))
            {
                return;
            }

            inFlight = false;
            HitAction.transform.position = ArrowInteractable.transform.position;
            ArrowInteractable.gameObject.SetActive(false);
            HitAction.SetActive(true);
            Destroy(gameObject, 2f);
        }
Example #9
0
		internal BreakEvent (XmlElement elem)
		{
			string s = elem.GetAttribute ("enabled");
			if (s.Length > 0)
				enabled = bool.Parse (s);
			s = elem.GetAttribute ("hitAction");
			if (s.Length > 0)
				hitAction = (HitAction) Enum.Parse (typeof(HitAction), s);
			s = elem.GetAttribute ("customActionId");
			if (s.Length > 0)
				customActionId = s;
			s = elem.GetAttribute ("traceExpression");
			if (s.Length > 0)
				traceExpression = s;
			s = elem.GetAttribute ("hitCount");
			if (s.Length > 0)
				hitCount = int.Parse (s);
		}
Example #10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HitHandler"/> class.
 /// </summary>
 /// <param name="gameContext">The game context.</param>
 public HitHandler(IGameContext gameContext)
     : base(gameContext)
 {
     this.hitAction = new HitAction();
 }
Example #11
0
 public void Hit(object btn, EventArgs args)
 {
     Hit((btn as Button).Coordinates());
     HitAction?.Invoke();
 }
    protected override void OnButtonClicked()
    {
        var hitAction = new HitAction(playerController.Model);

        ActionSystem.Instance.PerformAction(hitAction);
    }
Example #13
0
		public virtual void CopyFrom (BreakEvent ev)
		{
			hitAction = ev.hitAction;
			customActionId = ev.customActionId;
			traceExpression = ev.traceExpression;
			hitCount = ev.hitCount;
		}
Example #14
0
        public void IsNotHittableTest(int cell)
        {
            var action = new HitAction(Alan, Oren, cell);

            Assert.IsTrue(action.OpponentShip.IsNull);
        }
		/// <summary>
		/// Makes a copy of this instance
		/// </summary>
		/// <param name='ev'>
		/// A break event from which to copy the data.
		/// </param>
		public virtual void CopyFrom (BreakEvent ev)
		{
			hitAction = ev.hitAction;
			customActionId = ev.customActionId;
			traceExpression = ev.traceExpression;
			hitCount = ev.hitCount;
			breakIfConditionChanges = ev.breakIfConditionChanges;
			conditionExpression = ev.conditionExpression;
		}