コード例 #1
0
    public void ApplyDamageModifier(DamageOnTouch damagingScript, bool isRanged)
    {
        Debug.Log("Adding modifier from " + this.gameObject.name + " to " + damagingScript.gameObject.name);

        Debug.Log("Changing from " + damagingScript.DamageCaused + " to " + (damagingScript.DamageCaused + data.attackDamageModifier));
        damagingScript.DamageCaused += weaponDamageModifier;
    }
コード例 #2
0
        public void CreateAttackArea()
        {
            damageArea      = new GameObject();
            damageArea.name = this.name + "DamageArea";

            damageArea.transform.position = transform.position;
            damageArea.transform.rotation = transform.rotation;

            damageArea.transform.SetParent(transform);

            damageCollider           = damageArea.AddComponent <BoxCollider2D>();
            damageCollider.offset    = areaOffset;
            damageCollider.size      = damageSize;
            damageCollider.isTrigger = true;

            Rigidbody2D rigidBody = damageArea.AddComponent <Rigidbody2D>();

            rigidBody.isKinematic = true;

            damageOnTouch = damageArea.AddComponent <DamageOnTouch>();
            damageOnTouch.targetLayerMask = targetLayerMaks;
            damageOnTouch.damage          = damage;
            damageOnTouch.knockDownTarget = knockDownTarget;
            damageOnTouch.owner           = gameObject;
        }
コード例 #3
0
 private void Start()
 {
     pauseShooting = false;
     rockOnPlayer  = true;
     rockGO        = Instantiate(rock, gameObject.transform.position, Quaternion.identity);
     rockMovement  = rockGO.GetComponent <Rock>();
     damage        = rockGO.GetComponentInChildren <DamageOnTouch>();
 }
コード例 #4
0
    public IAbilityObject Spawn(Ability ability, float multiplier)
    {
        DamageOnTouch damageOnTouch = GameObject.Instantiate(this);

        damageOnTouch.action     = ability.Action;
        damageOnTouch.Multiplier = multiplier;

        return(damageOnTouch);
    }
コード例 #5
0
    public void Death()
    {
        myAgent.enabled = false;
        DamageOnTouch damageOnTouch = GetComponent <DamageOnTouch>();

        if (damageOnTouch != null)
        {
            Destroy(damageOnTouch);
        }
        Instantiate(myDeathParticleSystem, transform.position + new Vector3(0, myAgent.height, 0), Quaternion.LookRotation((transform.position - myLastAttackOrigin).normalized, Vector3.up));
        Destroy(gameObject);
    }
コード例 #6
0
    protected override void Awake()
    {
        base.Awake();

        bulletBody      = GetComponent <Rigidbody>();
        bulletCollider  = GetComponent <BoxCollider>();
        bulletSprite    = GetComponent <SpriteRenderer>();
        damageComponent = GetComponent <DamageOnTouch>();
        bulletVFX       = GetComponent <ParticleSystem>();

        EnterPoolEvent += OnEnterPool;
    }
コード例 #7
0
 // Use this for initialization
 void Start()
 {
     state            = "idle";
     original         = this.gameObject.GetComponent <SpriteRenderer>().color;
     prepTime         = 1.5f;
     prevLoc          = transform.position.x;
     controller       = GetComponent <CorgiController>();
     time             = 0;
     cooldown         = 3;
     range            = 3;
     movement         = GetComponent <CharacterHorizontalMovement>();
     damTouch         = GetComponent <DamageOnTouch>();
     damTouch.enabled = false;
 }
コード例 #8
0
    protected virtual void Awake()
    {
        _rigidbody       = this.gameObject.GetComponent <Rigidbody>();
        _damageOnTouch   = this.gameObject.GetComponent <DamageOnTouch>();
        _aiBehaviour     = this.gameObject.GetComponent <MoreMountains.LDJAM42.AIBehaviour>();
        _agentController = this.gameObject.GetComponent <AgentController>();
        _wandering       = this.gameObject.GetComponent <ProjectilesWandering>();
        _health          = this.gameObject.GetComponent <Health>();
        _thrownObject    = this.gameObject.GetComponent <ThrownObject>();

        Ripple.Stop();

        _initialDrag = _rigidbody.drag;
        _initialMass = _rigidbody.mass;
    }
コード例 #9
0
    private IEnumerator AttackAction()
    {
        DamageOnTouch currentDamage = damageDown;

        switch (facing)
        {
        case FacingDiractions.Up:
            currentDamage = damageUp;
            break;

        case FacingDiractions.Down:
            currentDamage = damageDown;
            break;

        case FacingDiractions.Left:
            currentDamage = damageLeft;
            break;

        case FacingDiractions.Right:
            currentDamage = damageRight;
            break;
        }

        isInAttack = true;

        if (!_isAttacking)
        {
            SoundManager.PlaySound(SoundManager.Sound.sword);
        }

        currentDamage.Attack();

        yield return(new WaitForSeconds(timeInAttack));

        currentDamage.EndAttack();
        isInAttack = false;
    }