示例#1
0
    void Start()
    {
        dude       = GetComponent <Dude>();
        swordzDude = GetComponent <SwordzDude>();
        damageable = GetComponent <Damageable>();

        actualAttackRate = attackRate + (Random.value - 0.5f) * attackRateFluctuation;
        lastAttackTime   = -actualAttackRate;

        // HACK : get me outta here!
        animated = swordzDude.animated;         // transform.Find("graphics/bjorn");

        avoider = gameObject.GetComponentInChildren <Avoider>();
        if (avoider != null)
        {
            Physics.IgnoreCollision(collider, avoider.collider);
        }

        sqrAttackDistance = Mathf.Pow(attackDistance, 2);
        sqrDangerDistance = Mathf.Pow(dangerDistance, 2);

        // offset the start of the think ticks to spread the load out a little
        lastThought += thinkPeriod * Random.value;
        lastReact   += reactPeriod * Random.value;

        StartCoroutine("SummoningSickness");
    }
示例#2
0
    void Start()
    {
        owner       = GetComponent <Dude>();
        ownerSwordz = GetComponent <SwordzDude>();
        damageable  = GetComponent <Damageable>();

        if (hotspot == null)
        {
            hotspot = transform;
        }
    }
示例#3
0
    void Awake()
    {
        character = GetComponent<CharacterController>();
        dude = gameObject.GetComponent<Dude>();
        swordzDude = gameObject.GetComponent<SwordzDude>();
        damageable = gameObject.GetComponent<Damageable>();
        detector = gameObject.GetComponentInChildren<Detector>();
        //controller = gameObject.GetComponent(typeof(DudeController)) as DudeController;

        attackers = new List<GameObject>();
    }
示例#4
0
    void Awake()
    {
        character  = GetComponent <CharacterController>();
        dude       = gameObject.GetComponent <Dude>();
        swordzDude = gameObject.GetComponent <SwordzDude>();
        damageable = gameObject.GetComponent <Damageable>();
        detector   = gameObject.GetComponentInChildren <Detector>();
        //controller = gameObject.GetComponent(typeof(DudeController)) as DudeController;

        attackers = new List <GameObject>();
    }
示例#5
0
    public void Start()
    {
        dude   = GetComponent(typeof(Dude)) as Dude;
        swordz = GetComponent(typeof(SwordzDude)) as SwordzDude;

        cam = Camera.main;

        if (aimMethod == "mouse")
        {
            Screen.showCursor = true;
        }

        // automatically set up move axes to match the camera
        SetMovementAxes(cam.transform.right * 0.5f, cam.transform.forward * 0.5f);
    }
示例#6
0
    void Think()
    {
        preyObject = GetClosestTarget();

        // durr... nothing to kill!
        if (preyObject == null)
        {
            return;
        }

        prey       = preyObject.GetComponent <Dude>();
        preySwordz = preyObject.GetComponent <SwordzDude>();
        var damageable = preyObject.GetComponent <Damageable>();

        // don't kill dead things
        // WHAT IS DEAD MAY NEVER DIE
        if (damageable != null && damageable.GetHealth() <= 0)
        {
            return;
        }

        // for enemy pack avoidance
        if (avoider != null && avoider.avoidEnemy != null)
        {
            avoidVec = avoider.avoidEnemy.transform.position - transform.position;
            avoidVec = Vector3.Slerp(distVec.normalized, avoidVec.normalized, 0.5f);
        }
        else
        {
            avoidVec = Vector3.zero;
        }

        // for strafing, if I decide to strafe
        if (!engagePrey && strafeCooldown <= 0f)
        {
            strafeCooldown = strafeRate;
            strafeDir      = 1.0f;
            if (Random.value > 0.5f)
            {
                strafeDir = -1.0f;
            }
        }
    }
示例#7
0
    void Think()
    {
        preyObject = GetClosestTarget();

        // durr... nothing to kill!
        if(preyObject == null)
        {
            return;
        }

        prey = preyObject.GetComponent<Dude>();
        preySwordz = preyObject.GetComponent<SwordzDude>();
        var damageable = preyObject.GetComponent<Damageable>();

        // don't kill dead things
        // WHAT IS DEAD MAY NEVER DIE
        if(damageable != null && damageable.GetHealth() <= 0)
        {
            return;
        }

        // for enemy pack avoidance
        if(avoider != null && avoider.avoidEnemy != null)
        {
            avoidVec = avoider.avoidEnemy.transform.position - transform.position;
            avoidVec = Vector3.Slerp(distVec.normalized, avoidVec.normalized, 0.5f);
        }
        else
        {
            avoidVec = Vector3.zero;
        }

        // for strafing, if I decide to strafe
        if(!engagePrey && strafeCooldown <= 0f)
        {
            strafeCooldown = strafeRate;
            strafeDir = 1.0f;
            if(Random.value > 0.5f) strafeDir = -1.0f;
        }
    }
示例#8
0
    void Start()
    {
        dude = GetComponent<Dude>();
        swordzDude = GetComponent<SwordzDude>();
        damageable = GetComponent<Damageable>();

        actualAttackRate = attackRate + (Random.value - 0.5f) * attackRateFluctuation;
        lastAttackTime = -actualAttackRate;

        // HACK : get me outta here!
        animated = swordzDude.animated; // transform.Find("graphics/bjorn");

        avoider = gameObject.GetComponentInChildren<Avoider>();
        if(avoider != null)
        {
            Physics.IgnoreCollision(collider, avoider.collider);
        }

        sqrAttackDistance = Mathf.Pow(attackDistance, 2);
        sqrDangerDistance = Mathf.Pow(dangerDistance, 2);

        // offset the start of the think ticks to spread the load out a little
        lastThought += thinkPeriod * Random.value;
        lastReact += reactPeriod * Random.value;

        StartCoroutine("SummoningSickness");
    }
示例#9
0
 void Awake()
 {
     health = maxHealth;
     dude   = GetComponent <Dude>();
     swordz = GetComponent <SwordzDude>();
 }
示例#10
0
 void Awake()
 {
     health = maxHealth;
     dude = GetComponent<Dude>();
     swordz = GetComponent<SwordzDude>();
 }
示例#11
0
    void Start()
    {
        owner = GetComponent<Dude>();
        ownerSwordz = GetComponent<SwordzDude>();
        damageable = GetComponent<Damageable>();

        if(hotspot == null)
        {
            hotspot = transform;
        }
    }
示例#12
0
    public void Start()
    {
        dude = GetComponent(typeof(Dude)) as Dude;
        swordz = GetComponent(typeof(SwordzDude)) as SwordzDude;

        cam = Camera.main;

        if( aimMethod == "mouse" ) Screen.showCursor = true;

        // automatically set up move axes to match the camera
        SetMovementAxes(cam.transform.right * 0.5f, cam.transform.forward * 0.5f);
    }