コード例 #1
0
    // Override: FSMAction::OnAction()
    override public void onAction()
    {
        // Local variables
        Antonio ant = null;

        // Auto-find?
        if (m_antonio == null && m_autoFindAntonio == true)
        {
            m_antonio = GameObject.FindGameObjectWithTag(Tags.TAG_COMPANION);
        }
        if (m_antonio == null)
        {
            Debug.LogError("Game-object of antonio is missing!");
            return;
        }

        // Get script
        ant = m_antonio.GetComponent <Antonio>();
        if (ant == null)
        {
            ant = m_antonio.GetComponentInChildren <Antonio>();
            if (ant == null)
            {
                Debug.LogError("Game-object of antonio is invalid!");
                return;
            }
        }

        // Set attributes
        ant.m_chase          = m_followPlayer;
        ant.m_targetDistance = float.MaxValue;
    }
コード例 #2
0
    // Use this for initialization
    void Start()
    {
        // init values
        m_allowToMove = true;
        m_canFly      = false;
        m_canFall     = false;

        // base start
        base.Awake();

        // set some important values
        m_direction  = 0;
        m_lifepoints = GameConfig.CHICO_LIFE_POINTS;

        // last spawn time for the chico birds
        m_allowToSpawn       = false;
        m_lastSpawnTime      = 0;
        m_spawningCrewPrefab = Resources.Load <GameObject>("Actors/Enemies/ChicosCrew");
        if (m_spawningCrewPrefab == null)
        {
            Debug.LogWarning("Chico: Crew not found!");
        }
        else if (m_spawningCrewPrefab.transform.childCount == 0)
        {
            Debug.LogWarning("Chico: Prefabs havent birds!");
        }
        else
        {
            m_littleBirdLocalScale = m_spawningCrewPrefab.transform.GetChild(0).localScale;
        }

        // create new
        m_chicosActiveCrew = new GameObject("ChicosCrew");
        m_chicosActiveCrew.transform.parent     = this.transform.parent;
        m_chicosActiveCrew.transform.localScale = new Vector3(1, 1, 1);

        // init death values
        m_isAlive    = true;
        m_deathEvent = new LinkedList <Action>();

        // init antonio
        m_antonio = null;
        GameObject obj = GameObject.FindGameObjectWithTag(Tags.TAG_COMPANION);

        if (obj == null)
        {
            Debug.Log("BS: Antonio dont found!");
            return;
        }

        m_antonio = obj.GetComponent <Antonio>();
    }
コード例 #3
0
    void Start()
    {
        m_antonio = null;
        GameObject obj = GameObject.FindGameObjectWithTag(Tags.TAG_COMPANION);

        if (obj == null)
        {
            Debug.Log("BS: Antonio dont found!");
            return;
        }

        m_antonio = obj.GetComponent <Antonio>();
    }
コード例 #4
0
    // Use this for initialization
    void Start()
    {
        // set lifepoints
        m_lifepoints = GameConfig.HIGGINS_LIFE_POINTS;

        // seek the player
        GameObject _p = GameObject.FindGameObjectWithTag(Tags.TAG_PLAYER);

        if (_p == null)
        {
            m_player = null;
        }
        else
        {
            m_player = _p.transform;
        }

        // seek Antonio
        m_antonioKI = null;
        GameObject[] _a = GameObject.FindGameObjectsWithTag(Tags.TAG_COMPANION);
        foreach (GameObject g in _a)
        {
            if (g.name.Equals(GameConfig.ANTONIO_GAME_OBJECT_NAME))
            {
                m_antonioKI = g.GetComponentInChildren <Antonio>();
                if (m_antonioKI != null)
                {
                    m_antonioStartChaseValue = m_antonioKI.m_chase;
                }
                break;
            }
        }

        // load the ThrownEgg prefab
        ThrownEgg = Resources.Load <GameObject>("Items/ThrownEgg");

        // init last egg throw
        m_lastEggThrow = Time.time - GameConfig.HIGGINS_THROW_DIFFENRENCE;

        // save start X
        m_startX = transform.position.x;

        // let call the method of the base
        m_canFly = true;
        base.Awake();

        // higgins not active at start
        m_active = false;

        // calculate the radius to activate Higgins
        m_sqrActivateRadius = Mathf.Pow(m_controller.radius * m_worldScale.x * 5, 2);

        //turnAround();
        m_direction           *= -1;
        this.m_groundFlyValue /= 4;

        // init antonio

        m_antonio = null;
        GameObject obj = GameObject.FindGameObjectWithTag(Tags.TAG_COMPANION);

        if (obj == null)
        {
            Debug.Log("BS: Antonio dont found!");
            return;
        }

        m_antonio = obj.GetComponent <Antonio>();
    }