Ejemplo n.º 1
0
    void OnParticleCollision(GameObject other)
    {
        if (other == null || EngineControl.dead)
        {
            return;                                     //avatars can't shoot you, and you can't get hurt when you're dead
        }
        SendCustomNetworkEvent(VRC.Udon.Common.Interfaces.NetworkEventTarget.All, "PlaneHit");

        GameObject    EnemyObjs          = other;
        HitDetector   EnemyHitDetector   = null;
        AAMController EnemyAAMController = null;

        while (EnemyAAMController == null && EnemyHitDetector == null && EnemyObjs.transform.parent != null)
        {
            EnemyObjs          = EnemyObjs.transform.parent.gameObject;
            EnemyHitDetector   = EnemyObjs.GetComponent <HitDetector>();
            EnemyAAMController = EnemyObjs.GetComponent <AAMController>();
        }
        if (EnemyHitDetector != null)
        {
            LastAttacker = EnemyHitDetector.EngineControl;
        }
        if (EnemyAAMController != null)
        {
            LastAttacker = EnemyAAMController.EngineControl;
        }
        LastHitTime = Time.time;
    }
    public void createAbilityObject()
    {
        if (requireNotPartOfChain)
        {
            ChainOnHit chain = GetComponent <ChainOnHit>();
            if (chain && (chain.chainsRemaining > 0 || chain.hasChained))
            {
                return;
            }
        }


        HitDetector hitDetector = GetComponent <HitDetector>();

        if (hitDetector)
        {
            List <GameObject> enemies = new List <GameObject>();

            if (hitDetector.sharedHitDetector != null)
            {
                foreach (GameObject enemy in hitDetector.sharedHitDetector.enemiesHit)
                {
                    if (enemy != null && !enemies.Contains(enemy))
                    {
                        enemies.Add(enemy);
                    }
                }
            }
            else
            {
                foreach (GameObject enemy in hitDetector.enemiesHit)
                {
                    if (enemy != null && !enemies.Contains(enemy))
                    {
                        enemies.Add(enemy);
                    }
                }
            }



            CreationReferences references = GetComponent <CreationReferences>();
            if (references)
            {
                Vector3 startPos = references.locationCreatedFrom;

                // create the first ability object
                if (enemies.Count >= 1 && castFromCreatorToo)
                {
                    GetComponent <AbilityObjectConstructor>().constructAbilityObject(abilityToInstantiate, startPos + offset, enemies[0].transform.position + offset);
                }

                for (int i = 0; i < enemies.Count - 1; i++)
                {
                    // create the other ability objects
                    GetComponent <AbilityObjectConstructor>().constructAbilityObject(abilityToInstantiate, enemies[i].transform.position + offset, enemies[i + 1].transform.position + offset);
                }
            }
        }
    }
Ejemplo n.º 3
0
    private void Awake()
    {
        source = GetComponent <AudioSource>();

        detector        = GetComponentInChildren <HitDetector>();
        detector.onHit += OnDetectorHit;
    }
Ejemplo n.º 4
0
 private void Awake()
 {
     if (this._hitDetector == null)
     {
         this._hitDetector = base.getComponentInParent <HitDetector>();
     }
 }
Ejemplo n.º 5
0
 public void OnDetectorHit(HitDetector hitDetectorWhichWasHit, Player scoringPlayer)
 {
     if (hitDetectorWhichWasHit == detector)
     {
         DissolvePot();
     }
 }
Ejemplo n.º 6
0
    private void Start()
    {
        detector  = GetComponentInChildren <HitDetector>();
        renderers = GetComponentsInChildren <MeshRenderer>();

        detector.onHit += OnDetectorHit;
    }
Ejemplo n.º 7
0
    // Start is called before the first frame update
    void Start()
    {
        if (GameObject.Find("PlayerData").GetComponent <SelectedCharacterManager>().P1Side == "Left")
        {
            P1Prop = GameObject.Find("Player1").transform.GetComponentInChildren <CharacterProperties>();
            P2Prop = GameObject.Find("Player2").transform.GetComponentInChildren <CharacterProperties>();
            P1hit  = GameObject.Find("Player1").transform.GetComponentInChildren <HitDetector>();
            P2hit  = GameObject.Find("Player2").transform.GetComponentInChildren <HitDetector>();
        }
        else
        {
            P1Prop = GameObject.Find("Player2").transform.GetComponentInChildren <CharacterProperties>();
            P2Prop = GameObject.Find("Player1").transform.GetComponentInChildren <CharacterProperties>();
            P1hit  = GameObject.Find("Player2").transform.GetComponentInChildren <HitDetector>();
            P2hit  = GameObject.Find("Player1").transform.GetComponentInChildren <HitDetector>();
        }

        combotimer1.fillAmount = 0;
        combotimer2.fillAmount = 0;
        Player1Combo.text      = "";
        Player2Combo.text      = "";

        regen   = Animator.StringToHash("Regen");
        shatter = Animator.StringToHash("Shatter");

        P1HitsPos  = Player1Hits.rectTransform.anchoredPosition;
        P1ComboPos = Player1Combo.rectTransform.anchoredPosition;

        P2HitsPos  = Player2Hits.rectTransform.anchoredPosition;
        P2ComboPos = Player2Combo.rectTransform.anchoredPosition;

        SetCharacterPortrait();
    }
Ejemplo n.º 8
0
    // Start is called before the first frame update
    void Start()
    {
        detector = Instantiate(hitDetectorPrefab, new Vector3(0, 0, 0), new Quaternion(0, 0, 0, 1)).GetComponent <HitDetector>();
        detector.gameObject.transform.SetParent(this.gameObject.transform, false);
        detector.gameObject.transform.localScale = new Vector3(attackRange, 1, attackRange);

        rb = GetComponent <Rigidbody>();
    }
Ejemplo n.º 9
0
 void Start()
 {
     ballRigidBody            = GetComponent <Rigidbody> ();
     ballRigidBody.useGravity = false;
     initialPosition          = transform.position;
     misses      = FindObjectOfType <AttemptsRemaining> ();
     hitDetector = FindObjectOfType <HitDetector> ();
 }
Ejemplo n.º 10
0
    // Use this for initialization
    void Start()
    {
        mutatorManager      = GetComponent <AbilityMutatorManager>();
        myAlignmentManager  = GetComponent <AlignmentManager>();
        myTaggedStatsHolder = GetComponent <TaggedStatsHolder>();

        myCreationReferences = GetComponent <CreationReferences>();
        myHitDetector        = GetComponent <HitDetector>();
    }
Ejemplo n.º 11
0
 // Use this for initialization
 void Start()
 {
     returner = GetComponent <ReturnToCasterAfterDuration>();
     // subscribe to the inanimate hit event
     detector = GetComponent <HitDetector>();
     if (detector)
     {
         detector.inanimateHitEvent += startReturn;
     }
 }
Ejemplo n.º 12
0
 void Start()
 {
     hitDetector  = GetComponent <HitDetector>();
     myReferences = GetComponent <CreationReferences>();
     if (hitDetector)
     {
         // subscribe to the new ally hit event
         hitDetector.newAllyHitEvent += createAbilityObjectIfNeeded;
     }
 }
Ejemplo n.º 13
0
 // Start is called before the first frame update
 void Start()
 {
     noColor = new Color32(0, 0, 0, 0);
     if (transform.parent.gameObject.name == "Sprite")
     {
         colorNum  = transform.parent.GetComponent <ColorSwapDHA>().colorNum;
         HitDetect = transform.parent.GetComponent <ColorSwapDHA>().HitDetect;
     }
     sprite = transform.GetComponent <SpriteRenderer>();
     InitColorSwapTex();
     ApplyPalette();
 }
Ejemplo n.º 14
0
 void OnDetectedHit(HitDetector detector, Collider2D other)
 {
     if ("Ground".Equals(LayerMask.LayerToName(other.gameObject.layer)))
     {
         _anim.SetBool("isOnGround", true);
         // Shake the screen when character kicks on ground.
         StartCoroutine(Utility.Shaking2D(_shakingDuration, _shakingAmount, _theCamera.transform
                                          , () => ControlLock.Lock("Camera1")
                                          , () => ControlLock.ReleaseLock("Camera1")));
     }
     HandleState("KickDown", "Off");
 }
Ejemplo n.º 15
0
 // Use this for initialization
 void Start()
 {
     detector = GetComponent <HitDetector>();
     if (hitsAllies)
     {
         detector.newAllyHitEvent += chain;
     }
     else
     {
         detector.newEnemyHitEvent += chain;
     }
 }
Ejemplo n.º 16
0
    // Use this for initialization
    void Start()
    {
        HitDetector hitDetector = GetComponent <HitDetector>();

        if (triggerType == ActorType.Enemy || triggerType == ActorType.Any)
        {
            hitDetector.newEnemyHitEvent += Trigger;
        }
        if (triggerType == ActorType.Ally || triggerType == ActorType.Any)
        {
            hitDetector.newAllyHitEvent += Trigger;
        }
    }
Ejemplo n.º 17
0
 // Use this for initialization
 void Start()
 {
     hitDetector = GetComponent <HitDetector>();
     if (hitDetector)
     {
         // subscribe to the new enemy hit event
         hitDetector.newEnemyHitEvent += applyDamage;
         // if it can damage the same enemy again also subscribe to the enemy hit again event
         if (canDamageSameEnemyAgain)
         {
             hitDetector.enemyHitAgainEvent += applyDamage;
         }
     }
 }
Ejemplo n.º 18
0
    private void Start()
    {
        InputHandler.OnTapEvent        += OnTap;
        InputHandler.OnSwipeUpEvent    += OnSwipeUp;
        InputHandler.OnSwipeDownEvent  += OnSwipeDown;
        InputHandler.OnSwipeLeftEvent  += OnSwipeLeft;
        InputHandler.OnSwipeRightEvent += OnSwipeRight;
        InputHandler.OnHoldEvent       += OnHold;

        mHipTransform       = transform.GetChild(0);
        mAnimator           = GetComponent <Animator>();
        mInitPlayerPosition = transform.position;
        TargetDetector      = GetComponentInChildren <TargetDetector>();
        HitDetector         = GetComponentInChildren <HitDetector>();
    }
Ejemplo n.º 19
0
 // Use this for initialization
 void Start()
 {
     hitDetector  = GetComponent <HitDetector>();
     myReferences = GetComponent <CreationReferences>();
     if (hitDetector)
     {
         // subscribe to the new ally hit event
         hitDetector.newAllyHitEvent += preApplyDamage;
         // if it can damage the same ally again also subscribe to the ally hit again event
         if (canDamageSameAllyAgain)
         {
             hitDetector.allyHitAgainEvent += preApplyDamage;
         }
     }
 }
Ejemplo n.º 20
0
    IEnumerator StartKickDown()
    {
        _isInCooldown = true;
        ControlLock.Lock("Move");
        _anim.SetBool("isKickDown", true);
        var length = Utility.GetAnimationLength(_anim, "Kick Down");

        _rb.velocity = Vector2.up * -2.5f;
        // Create the shadow sample
        var shadowSample = Utility.CreateSpriteRendererBySample(_sprite.sprite, transform.position, transform.localScale, .25f);

        Destroy(shadowSample.gameObject, .075f);
        // Create the effect
        _curFx = InstantiateEffect();
        yield break;
    }
Ejemplo n.º 21
0
    public Sword sword;      // Reference to Sword script
    #endregion


    // Start is called before the first frame update
    void Start()
    {
        // Initialize Rigidbody reference
        rb = GetComponent <Rigidbody>();

        // Initialize sprite animator
        GameObject sprite = transform.Find("sprite").gameObject;

        animator = sprite.GetComponent <Animator>();

        // Initialize radius of player
        Vector3 spriteBounds = sprite.GetComponent <SpriteRenderer>().bounds.size;

        radius = spriteBounds.x / 2;

        // Initialize magic
        equippedMagic = gameObject.AddComponent <Fire>();

        // Point player sprite in same direction as camera
        transform.forward = -Camera.main.transform.forward;
        transform.up      = Camera.main.transform.up;

        // Initialize sword and place it in hand
        hand = transform.Find("Hand");
        sword.transform.parent        = hand;
        sword.transform.localPosition = Vector3.zero;
        sword.transform.localRotation = Quaternion.identity;

        // Initialize attack animation
        AttackAnim = sword.GetComponent <Animator>();

        // Initialize resurrection circle reference
        ressurector = gameObject.GetComponentInChildren <Resurrector>();

        // Initiaize hit detector reference
        hitbox = gameObject.GetComponentInChildren <HitDetector>();

        // Initialize hit detector range
        hitbox.transform.localScale = new Vector3(HITBOX_SIZE, HITBOX_HEIGHT, HITBOX_SIZE);

        // Set initial attack state to true
        canAttack = true;
    }
Ejemplo n.º 22
0
    protected void chainTo(GameObject target, GameObject from)
    {
        AbilityObjectConstructor aoc = GetComponent <AbilityObjectConstructor>();
        GameObject newAbilityObject  = aoc.constructAbilityObject(abilityToChain, transform.position, target.transform.position + offset);

        // reduce the chains remaining
        if (limitNumberOfChains)
        {
            ChainOnHit newChain = newAbilityObject.GetComponent <ChainOnHit>();
            if (!newChain)
            {
                newChain = newAbilityObject.AddComponent <ChainOnHit>();
            }
            newChain.chainsRemaining          = chainsRemaining - 1;
            newChain.abilityToChain           = abilityToChain;
            newChain.range                    = range;
            newChain.destroyAfterChainAttempt = destroyAfterChainAttempt;
            newChain.cannotHitSame            = cannotHitSame;
            newChain.offset                   = offset;
        }

        if (cannotHitSame)
        {
            HitDetector detector = newAbilityObject.GetComponent <HitDetector>();
            if (hitsAllies)
            {
                detector.alliesHit.Add(from);
                if (detector.sharedHitDetector)
                {
                    detector.sharedHitDetector.alliesHit.Add(from);
                }
            }
            else
            {
                detector.enemiesHit.Add(from);
                if (detector.sharedHitDetector)
                {
                    detector.sharedHitDetector.enemiesHit.Add(from);
                }
            }
        }
    }
Ejemplo n.º 23
0
    // Start is called before the first frame update
    void Start()
    {
        Application.targetFrameRate = 60;

        LoGuard  = Animator.StringToHash("LowGuard");
        HiGuard  = Animator.StringToHash("HighGuard");
        AirGuard = Animator.StringToHash("AirGuard");

        crouchID      = Animator.StringToHash("Crouch");
        runID         = Animator.StringToHash("Run");
        animSpeedID   = Animator.StringToHash("AnimSpeed");
        hitStunID     = Animator.StringToHash("HitStun");
        blockStunID   = Animator.StringToHash("BlockStun");
        clashID       = Animator.StringToHash("Clash");
        deflectID     = Animator.StringToHash("Deflected");
        parryID       = Animator.StringToHash("Parry");
        successID     = Animator.StringToHash("HitSuccess");
        hitID         = Animator.StringToHash("Hit");
        hitAirID      = Animator.StringToHash("HitAir");
        hitBodyID     = Animator.StringToHash("HitBody");
        hitLegsID     = Animator.StringToHash("HitLegs");
        launchID      = Animator.StringToHash("Launch");
        crumpleID     = Animator.StringToHash("Crumple");
        sweepID       = Animator.StringToHash("Sweep");
        shatterID     = Animator.StringToHash("Shatter");
        armorHitID    = Animator.StringToHash("ArmorHit");
        throwRejectID = Animator.StringToHash("ThrowReject");
        dizzyID       = Animator.StringToHash("Dizzy");
        KOID          = Animator.StringToHash("KOed");

        guardID = Animator.StringToHash("Guard");

        pauseScreen = GameObject.Find("PauseManager").GetComponentInChildren <PauseMenu>();

        Actions          = transform.root.GetChild(0).transform.GetComponentInChildren <AcceptInputs>();
        HitDetect        = Actions.Move.HitDetect;
        OpponentDetector = HitDetect.OpponentDetector;
    }
Ejemplo n.º 24
0
    private void Awake()
    {
        _hitDetector = GetComponent <HitDetector>();

        RestoreHealth();
    }
Ejemplo n.º 25
0
 void OnDetectedHit(HitDetector detector, Collider2D other)
 {
     // StartCoroutine(DoReflectiveForce());
     ControlLock.Lock("Move");
     _player.extraForceX -= .5f * _faceX;
 }
Ejemplo n.º 26
0
 void OnDetectedHit(HitDetector detector, Collider2D other)
 {
 }
Ejemplo n.º 27
0
    // Update is called once per frame
    void Update()
    {
        if (Actions == null || HitDetect == null || OpponentDetector == null)
        {
            Actions          = transform.root.GetChild(0).transform.GetComponentInChildren <AcceptInputs>();
            HitDetect        = Actions.Move.HitDetect;
            OpponentDetector = HitDetect.OpponentDetector;
        }
        opponentValor = Actions.Move.OpponentProperties.currentValor;

        if ((Input.GetButtonDown("Start_P1") || Input.GetButtonDown("Start_P2")) && pauseScreen.isPaused)
        {
            currentVelocity        = rb.velocity;
            currentAngularVelocity = rb.angularVelocity;
        }

        if ((pauseScreen.isPaused && hitStop <= 0) || OpponentDetector.Actions.superFlash > 0)
        {
            hitStop = (float)1 / 60;
        }

        if (hitStop > 0)
        {
            //hitStop to give hits more impact and allow time to input next move
            anim.SetFloat(animSpeedID, 0f);
            rb.constraints = RigidbodyConstraints2D.FreezeAll;
            if (!pauseScreen.isPaused)
            {
                hitStop -= Time.deltaTime;
            }
        }
        else
        {
            hitStop = 0;
            anim.SetFloat(animSpeedID, 1.0f);
            if (rb.constraints == RigidbodyConstraints2D.FreezeAll)
            {
                rb.constraints = RigidbodyConstraints2D.None;
            }

            if (OpponentDetector.Actions.blitzed > 0)
            {
                //simulate slow motion on projectile if within range of a blitz cancel or blitz attack
                if (OpponentDetector.Actions.blitzed <= (float)59 / 60 && OpponentDetector.Actions.blitzed >= (float)58 / 60)
                {
                    rb.velocity        *= .5f;
                    rb.angularVelocity *= .75f;
                    rb.mass            *= .5f;
                    rb.gravityScale    *= .5f;
                }

                anim.SetFloat(animSpeedID, .5f);
            }
            else if (OpponentDetector.Actions.blitzed >= (float)1 / 60 && OpponentDetector.Actions.blitzed <= (float)2 / 60)
            {
                rb.velocity        /= .5f;
                rb.angularVelocity /= .5f;

                rb.mass         /= .5f;
                rb.gravityScale /= .5f;
                anim.SetFloat(animSpeedID, 1f);
            }

            if (currentVelocity != Vector2.zero)
            {
                //retain velocity after hitStop occurs
                rb.velocity            = currentVelocity;
                rb.angularVelocity     = currentAngularVelocity;
                currentVelocity        = Vector2.zero;
                currentAngularVelocity = 0;
            }
        }

        if (hitStop == 0)
        {
            anim.ResetTrigger(successID);
        }
    }
Ejemplo n.º 28
0
    public GameObject constructAbilityObject(Ability ability, Vector3 location, Vector3 targetLocation, GameObject overridePrefab = null, bool InheritSharedHitDetector = true)
    {
        // create the ability object
        GameObject abilityObject = null;

        if (overridePrefab == null)
        {
            // if there is no override prefab instantiate the ability's ability prefab
            abilityObject = Instantiate(ability.abilityPrefab, location, Quaternion.Euler(targetLocation - location));
        }
        else // othewise instrantiate the override prefab
        {
            abilityObject = Instantiate(overridePrefab, location, Quaternion.Euler(targetLocation - location));
        }

        // apply the relevant mutator if this entity has one
        if (mutatorManager)
        {
            mutators = mutatorManager.getMutators(ability);
            if (mutators != null)
            {
                foreach (AbilityMutator mutator in mutators)
                {
                    abilityObject = mutator.Mutate(abilityObject, location, targetLocation);
                    if (mutator.changeLocation)
                    {
                        targetLocation = mutator.newLocation;
                    }
                    if (mutator.changeTargetLocation)
                    {
                        targetLocation = mutator.newTargetLocation;
                    }
                }
            }
        }

        // move the ability object if necessary
        foreach (DefineStartLocation defineStartLocation in abilityObject.GetComponents <DefineStartLocation>())
        {
            if (defineStartLocation.active)
            {
                defineStartLocation.setLocation(location, targetLocation);
                // the direction from the cast point needs to be maintained
                if (defineStartLocation.maintainDirectionFromCastPoint())
                {
                    targetLocation = abilityObject.transform.position + targetLocation - location;
                }
            }
        }


        // initialise a location detector if necessary
        LocationDetector locationDetector = abilityObject.GetComponent <LocationDetector>();

        if (locationDetector)
        {
            locationDetector.startLocation  = abilityObject.transform.position;
            locationDetector.targetLocation = targetLocation;
        }

        // rotate the ability object
        abilityObject.transform.LookAt(targetLocation);

        // give the ability object its alignment
        AlignmentManager abilityAlignmentManager = abilityObject.GetComponent <AlignmentManager>();

        if (!abilityAlignmentManager)
        {
            abilityAlignmentManager = abilityObject.AddComponent <AlignmentManager>();
        }
        abilityAlignmentManager.alignment = myAlignmentManager.alignment;

        // give the ability object its creation references
        CreationReferences abilityCreationReferences = abilityObject.GetComponent <CreationReferences>();

        if (!abilityCreationReferences)
        {
            abilityCreationReferences = abilityObject.AddComponent <CreationReferences>();
        }
        abilityCreationReferences.thisAbility         = ability;
        abilityCreationReferences.locationCreatedFrom = location;
        // if this an ability object then the creator is this objects creator, otherwise the creator is this object
        if (myCreationReferences && GetComponent <AbilityObjectIndicator>())
        {
            abilityCreationReferences.creator = myCreationReferences.creator;
        }
        else
        {
            abilityCreationReferences.creator = gameObject;
        }

        // check whether there should be a shared hit detector
        HitDetector abilityHitDetector = abilityObject.GetComponent <HitDetector>();

        if (abilityHitDetector)
        {
            SharedHitDetector sharedHitDetector = null;
            if (myHitDetector && myHitDetector.sharedHitDetector && InheritSharedHitDetector)
            {
                sharedHitDetector = myHitDetector.sharedHitDetector;
            }
            // create a shared hit detector
            else if (ability.sharedHitDetector)
            {
                GameObject newGameObject = new GameObject();
                sharedHitDetector = newGameObject.AddComponent <SharedHitDetector>();
                sharedHitDetector.gameObject.AddComponent <SelfDestroyer>();
                sharedHitDetector.name = abilityObject.name + "'s shared hit detector";
            }
            if (sharedHitDetector != null && !abilityHitDetector.cannotHaveSharedhitDetector)
            {
                abilityHitDetector.sharedHitDetector = sharedHitDetector;
            }
        }

        // build the damage stats for each damage stats holder
        foreach (DamageStatsHolder damageStatsHolder in abilityObject.GetComponents <DamageStatsHolder>())
        {
            damageStatsHolder.damageStats = DamageStats.buildDamageStats(damageStatsHolder, GetComponent <TaggedStatsHolder>());
        }

        // attach any on hit status appliers if this ability deals damage on hit
        if (myTaggedStatsHolder && abilityObject.GetComponent <DamageEnemyOnHit>() && !abilityObject.GetComponent <CannotApplyAdditionalStatuses>())
        {
            ChanceToApplyStatusOnEnemyHit applier;
            float poisonChance = myTaggedStatsHolder.GetStatValue(Tags.Properties.PoisonChance, ability.useTags);
            if (poisonChance > 0)
            {
                applier = abilityObject.AddComponent <ChanceToApplyStatusOnEnemyHit>();
                applier.statusEffect             = StatusEffectList.getEffect(StatusEffectID.Poison);
                applier.chance                   = poisonChance;
                applier.canApplyToSameEnemyAgain = false;
            }
            float igniteChance = myTaggedStatsHolder.GetStatValue(Tags.Properties.IgniteChance, ability.useTags);
            if (igniteChance > 0)
            {
                applier = abilityObject.AddComponent <ChanceToApplyStatusOnEnemyHit>();
                applier.statusEffect             = StatusEffectList.getEffect(StatusEffectID.Ignite);
                applier.chance                   = igniteChance;
                applier.canApplyToSameEnemyAgain = false;
            }
            float chillChance = myTaggedStatsHolder.GetStatValue(Tags.Properties.ChillChance, ability.useTags);
            if (chillChance > 0)
            {
                applier = abilityObject.AddComponent <ChanceToApplyStatusOnEnemyHit>();
                applier.statusEffect             = StatusEffectList.getEffect(StatusEffectID.Chill);
                applier.chance                   = chillChance;
                applier.canApplyToSameEnemyAgain = false;
            }
            float slowChance = myTaggedStatsHolder.GetStatValue(Tags.Properties.SlowChance, ability.useTags);
            if (slowChance > 0)
            {
                applier = abilityObject.AddComponent <ChanceToApplyStatusOnEnemyHit>();
                applier.statusEffect             = StatusEffectList.getEffect(StatusEffectID.Slow);
                applier.chance                   = slowChance;
                applier.canApplyToSameEnemyAgain = false;
            }
            float blindChance = myTaggedStatsHolder.GetStatValue(Tags.Properties.BlindChance, ability.useTags);
            if (blindChance > 0)
            {
                applier = abilityObject.AddComponent <ChanceToApplyStatusOnEnemyHit>();
                applier.statusEffect             = StatusEffectList.getEffect(StatusEffectID.Blind);
                applier.chance                   = blindChance;
                applier.canApplyToSameEnemyAgain = false;
            }

            float bleedChance = myTaggedStatsHolder.GetStatValue(Tags.Properties.BleedChance, ability.useTags);
            if (bleedChance > 0)
            {
                applier = abilityObject.AddComponent <ChanceToApplyStatusOnEnemyHit>();
                applier.statusEffect             = StatusEffectList.getEffect(StatusEffectID.Bleed);
                applier.chance                   = bleedChance;
                applier.canApplyToSameEnemyAgain = false;
            }
            float shockChance = myTaggedStatsHolder.GetStatValue(Tags.Properties.ShockChance, ability.useTags);
            if (shockChance > 0)
            {
                applier = abilityObject.AddComponent <ChanceToApplyStatusOnEnemyHit>();
                applier.statusEffect             = StatusEffectList.getEffect(StatusEffectID.Shock);
                applier.chance                   = shockChance;
                applier.canApplyToSameEnemyAgain = false;
            }
        }


        // if the ability has an ability object constructor give it a tagged stats holder with your tagged stats
        if (myTaggedStatsHolder && abilityObject.GetComponent <RequiresTaggedStats>())
        {
            TaggedStatsHolder holder = abilityObject.GetComponent <TaggedStatsHolder>();
            if (holder == null)
            {
                holder = abilityObject.AddComponent <TaggedStatsHolder>();
            }
            holder.simpleStats.AddRange(myTaggedStatsHolder.simpleStats);
            holder.taggedStats.AddRange(myTaggedStatsHolder.taggedStats);
        }

        // set the direction if there is an ability mover
        if (abilityObject.GetComponent <AbilityMover>())
        {
            abilityObject.GetComponent <AbilityMover>().positionDelta = Vector3.Normalize(targetLocation - location);
            // if the ability object defines its own start direction then let it
            if (abilityObject.GetComponent <DefineStartDirection>())
            {
                abilityObject.GetComponent <DefineStartDirection>().setDirection();
            }
        }

        // run any on creation methods
        foreach (OnCreation component in abilityObject.GetComponents <OnCreation>())
        {
            if (component.runOnCreation)
            {
                component.onCreation();
            }
        }

        // invoke the event
        if (abilityObjectCreatedEvent != null)
        {
            abilityObjectCreatedEvent.Invoke(ability, abilityObject);
        }

        return(abilityObject);
    }
Ejemplo n.º 29
0
    // Start is called before the first frame update
    void Start()
    {
        Player1          = GameObject.Find("Player1");
        Player2          = GameObject.Find("Player2");
        characterManager = GameObject.Find("PlayerData").GetComponent <SelectedCharacterManager>();
        P1Prop           = GameObject.Find("Player1").transform.GetComponentInChildren <CharacterProperties>();
        P2Prop           = GameObject.Find("Player2").transform.GetComponentInChildren <CharacterProperties>();
        P1hit            = GameObject.Find("Player1").transform.GetComponentInChildren <HitDetector>();
        P2hit            = GameObject.Find("Player2").transform.GetComponentInChildren <HitDetector>();
        P1Input          = GameObject.Find("Player1").transform.GetChild(0).transform.GetComponentInChildren <AcceptInputs>();
        P2Input          = GameObject.Find("Player2").transform.GetChild(0).transform.GetComponentInChildren <AcceptInputs>();
        P1Move           = GameObject.Find("Player1").transform.GetComponentInChildren <MovementHandler>();
        P2Move           = GameObject.Find("Player2").transform.GetComponentInChildren <MovementHandler>();
        HUD = GameObject.Find("HUD").GetComponent <HUD>();

        if (characterManager.P1Character == "Dhalia")
        {
            P1AttackDHA = GameObject.Find("Player1").transform.GetComponentInChildren <AttackHandlerDHA>();
        }
        if (characterManager.P2Character == "Dhalia")
        {
            P2AttackDHA = GameObject.Find("Player2").transform.GetComponentInChildren <AttackHandlerDHA>();
        }
        if (characterManager.P1Character == "Achealis")
        {
            P1AttackACH = GameObject.Find("Player1").transform.GetComponentInChildren <AttackHandlerACH>();
        }
        if (characterManager.P2Character == "Achealis")
        {
            P2AttackACH = GameObject.Find("Player2").transform.GetComponentInChildren <AttackHandlerACH>();
        }
        path = Application.persistentDataPath + "/inputs.txt";

        P1PrevHealth           = P1Prop.maxHealth;
        P2PrevHealth           = P2Prop.maxHealth;
        P1HitDamage.text       = "";
        P2HitDamage.text       = "";
        P1ComboDamage.text     = "Total Damage: 0";
        P2ComboDamage.text     = "Total Damage: 0";
        P1HighComboDamage.text = "Highest Combo Damage: 0";
        P2HighComboDamage.text = "Highest Combo Damage: 0";

        inputSelect     += UpdateControls(CheckXbox(0));
        inputR3         += UpdateControls(CheckXbox(0));
        inputL2         += UpdateControls(CheckXbox(0));
        inputL3         += UpdateControls(CheckXbox(0));
        inputCross      += UpdateControls(CheckXbox(0));
        inputCircle     += UpdateControls(CheckXbox(0));
        inputTriangle   += UpdateControls(CheckXbox(0));
        inputSquare     += UpdateControls(CheckXbox(0));
        inputHorizontal += UpdateControls(CheckXbox(0));
        inputVertical   += UpdateControls(CheckXbox(0));

        if (GameObject.Find("PlayerData").GetComponent <SelectedCharacterManager>().P1Side == "Left")
        {
            P2Displays.SetActive(false);
        }
        else
        {
            P1Displays.SetActive(false);
        }

        if (GameObject.Find("PlayerData").GetComponent <SelectedCharacterManager>().gameMode == "Practice")
        {
            DamageDisplays.SetActive(true);
            RecordingDisplay.SetActive(true);
        }
    }
Ejemplo n.º 30
0
 private void Start()
 {
     HitDetect = transform.root.GetChild(0).GetComponent <MovementHandler>().HitDetect;
 }