Beispiel #1
0
    // Use this for initialization
    void Start()
    {
        timer = 0.0f;
        TIMER_INC = 6;
        overFlag = 0;

        eventMan = GameObject.Find("Global Script Executor").GetComponent<CustomEventManager>();

        mMaterial = renderer.material;

        mAnimator = new CustomAnimator(ref mMaterial, 5,5);

        mAnimator.CreateAnimation("100",0,0,1);
        mAnimator.CreateAnimation ("0",20,20, 1);
        mAnimator.CreateAnimation("100-95", 0,1,1);
        mAnimator.CreateAnimation("95-90", 1,2,1);
        mAnimator.CreateAnimation("90-85", 2,3,1);
        mAnimator.CreateAnimation("85-80", 3,4,1);
        mAnimator.CreateAnimation("80-75", 4,5,1);
        mAnimator.CreateAnimation("75-70", 5,6,1);
        mAnimator.CreateAnimation("70-65", 6,7,1);
        mAnimator.CreateAnimation("65-60", 7,8,1);
        mAnimator.CreateAnimation("60-55", 8,9,1);
        mAnimator.CreateAnimation("55-50", 9,10,1);
        mAnimator.CreateAnimation("50-45", 10,11,1);
        mAnimator.CreateAnimation("45-40", 11,12,1);
        mAnimator.CreateAnimation("40-35", 12,13,1);
        mAnimator.CreateAnimation("35-30", 13,14,1);
        mAnimator.CreateAnimation("30-25", 14,15,1);
        mAnimator.CreateAnimation("25-20", 15,16,1);
        mAnimator.CreateAnimation("20-15", 16,17,1);
        mAnimator.CreateAnimation("15-10", 17,18,1);
        mAnimator.CreateAnimation("10-5", 18,19,1);
        mAnimator.CreateAnimation("5-0", 19,20,1);
    }
    public bool aiPickup2     = false; //used to initiate an item pickup

    protected virtual void Awake()
    {
        physics  = GetComponent <PlayerPhysics>();
        animator = GetComponent <CustomAnimator>();
        box      = GetComponent <BoxCollider2D>();
        ai       = GetComponent <AiBase>();
        passives = new List <Item>();
    }
 // Start is called before the first frame update
 public virtual void Start()
 {
     Register();
     Play        = MoveMode.Forward;
     TimeLine    = new Stack <TimeStamp>();
     _collider2D = GetComponent <BoxCollider2D>();
     _anim       = GetComponentInChildren <CustomAnimator>();
     Play        = MoveMode.Forward;
 }
Beispiel #4
0
 public TimeStamp(IMovable mov, CustomAnimator anim, long t)
 {
     Frame    = t;
     Position = mov.Position;
     Rotation = mov.Rotation;
     Velocity = mov.Velocity;
     sprite   = anim ? anim.sr.sprite : null;
     isLeft   = mov.IsLeft;
 }
Beispiel #5
0
 void Start()
 {
     try {
         _animator   = GetComponentInParent <CustomAnimator>();
         rg2d        = GetComponentInParent <Rigidbody2D>();
         _mainCamera = Camera.main.GetComponent <CameraController>();
     } catch (Exception e) {
         Debug.Log("Components could not be found");
     }
 }
Beispiel #6
0
 protected void Init()
 {
     try {
         rg2d              = GetComponent <Rigidbody2D>();
         pCol2D            = transform.FindChild("BumperCollider").GetComponent <PolygonCollider2D>();
         _animator         = GetComponent <CustomAnimator>();
         _gameSceneManager = GameObject.FindWithTag("GameSceneManager").GetComponent <GameSceneManager>();
     } catch (Exception e) {
         Debug.LogError("One of the component is not found : Source EntityMovementHandler ");
     }
 }
Beispiel #7
0
    public static CustomAnimator Build()
    {
        if (animatorPrefab == null)
        {
            animatorPrefab = Resources.Load <GameObject>("CustomAnimator");
        }

        GameObject     newAnimatorObj = Instantiate(animatorPrefab) as GameObject;
        CustomAnimator newAnimator    = newAnimatorObj.GetComponent <CustomAnimator>();

        return(newAnimator);
    }
Beispiel #8
0
    void Start()
    {
        instance = this;

        opponents = new Dictionary <int, PlayerStats>();

        ammoText  = GameObject.FindGameObjectWithTag("CurrentAmmo").GetComponent <Text>();
        maxAmmo   = GameObject.FindGameObjectWithTag("MaxAmmo").GetComponent <Text>();
        healthBar = GameObject.FindGameObjectWithTag("HealthBar").GetComponent <Slider>();

        animation = GetComponent <CustomAnimator>();

        canvas = GameObject.FindGameObjectWithTag("Canvas");
    }
Beispiel #9
0
    void Start()
    {
        CustomAnimator temp = gameObject.GetComponent <CustomAnimator>();

        temp.Init(10);

        temp.frames[0] = Assets.instance.dictionary[RegionNames.MINEB_0];
        temp.frames[1] = Assets.instance.dictionary[RegionNames.MINEB_1];
        temp.frames[2] = Assets.instance.dictionary[RegionNames.MINEB_2];
        temp.frames[3] = Assets.instance.dictionary[RegionNames.MINEB_3];
        temp.frames[4] = Assets.instance.dictionary[RegionNames.MINEB_4];
        temp.frames[5] = Assets.instance.dictionary[RegionNames.MINEB_5];
        temp.frames[6] = Assets.instance.dictionary[RegionNames.MINEB_6];
        temp.frames[7] = Assets.instance.dictionary[RegionNames.MINEB_7];
        temp.frames[8] = Assets.instance.dictionary[RegionNames.MINEB_8];
        temp.frames[9] = Assets.instance.dictionary[RegionNames.MINEB_9];
    }
Beispiel #10
0
 public void Reset()
 {
     PlayerMove     = GetComponent <PlayerMove>();
     audioSource    = GetComponent <AudioSource>();
     customAnimator = GetComponentInChildren <CustomAnimator>();
     customAnimator?.gameObject.SetActive(true);
     customAnimator?.Reset();
     if (GetComponent <PlayerMove>() == false)
     {
         gameObject.AddComponent <PlayerMove>();
     }
     PlayerMove = GetComponent <PlayerMove>();
     PlayerMove.Reset();
     IsDead           = false;
     gameObject.layer = LayerMask.NameToLayer("Player");
     GetComponent <CircleCollider2D>().isTrigger = false;
 }
Beispiel #11
0
    // Use this for initialization
    void Start()
    {
        movSpeedX = 150.0f;
        movSpeedY = 150.0f;

        mMoving = false;
        mAttacking = false;

        stunTimer = 0.0f;
        stunned = false;

        mMaterial = renderer.material;

        eventMan = GameObject.Find("Global Script Executor").GetComponent<CustomEventManager>();
        eventMan.EventListeners += RecieveEvent;

        mAnimator = new CustomAnimator(ref mMaterial, 6, 4);

        mAnimator.CreateAnimation("Standing Up", 18, 18, 1);
        mAnimator.CreateAnimation("Standing Left", 6, 6, 1);
        mAnimator.CreateAnimation("Standing Right", 12, 12, 1);
        mAnimator.CreateAnimation("Standing Down", 0, 0, 1);
        mAnimator.CreateAnimation("Walk Down", 1, 2, 0.2);
        mAnimator.CreateAnimation("Walk Left", 7, 8, 0.2);
        mAnimator.CreateAnimation("Walk Right", 13, 14, 0.2);
        mAnimator.CreateAnimation("Walk Up", 19, 20, 0.2);
        mAnimator.CreateAnimation("Sword Left", 9, 10, 0.2);
        mAnimator.CreateAnimation("Sword Right", 15, 16, 0.2);
        mAnimator.CreateAnimation("Sword Up", 21, 22, 0.2);
        mAnimator.CreateAnimation("Sword Down", 3, 4, 0.2);
        mAnimator.CreateAnimation("Gun Down", 5, 5, 0.3);
        mAnimator.CreateAnimation("Gun Left", 11, 11, 0.3);
        mAnimator.CreateAnimation("Gun Right", 17, 17, 0.3);
        mAnimator.CreateAnimation("Gun Up", 23, 23, 0.3);

        mAnimator.PlayAnimation("Standing Right", false);
        mOrientation = Orientation.RIGHT;
    }
Beispiel #12
0
    // Use this for initialization
    void Start()
    {
        alive = true;

        hp = 50;

        currentColor = ColorValue.RED;
        colorTimer = 0.0f;

        eventMan = GameObject.Find ("Global Script Executor").GetComponent<CustomEventManager>();
        eventMan.EventListeners += RecieveEvent;

        //target = GameObject.Find("Doctor").GetComponent<Transform>();

        mMaterial = renderer.material;
        mAnimator = new CustomAnimator(ref mMaterial, 4, 1);

        mAnimator.CreateAnimation("Red", 0, 0, 10000000);
        mAnimator.CreateAnimation("Blue", 1, 1, 10000000);
        mAnimator.CreateAnimation("Green", 2, 2, 10000000);
        mAnimator.CreateAnimation("Death", 3, 3, 10000000);
    }
Beispiel #13
0
    void Start()
    {
        alive = true;
        deathTimer = 0;
        xv = 0.0f;
        yv = 0.0f;
        timer = 0.0f;
        mMaterial = renderer.material;

        eventMan = GameObject.Find("Global Script Executor").GetComponent<CustomEventManager>();
        eventMan.EventListeners += RecieveEvent;

        mAnimator = new CustomAnimator(ref mMaterial, 4, 2);

        mAnimator.CreateAnimation("Up", 2, 2, 10000000);
        mAnimator.CreateAnimation("Down", 3, 3, 10000000);
        mAnimator.CreateAnimation("Left", 0,0, 10000000);
        mAnimator.CreateAnimation("Right", 1, 1, 10000000);
        mAnimator.CreateAnimation("Dead Up", 6, 6, 10000000);
        mAnimator.CreateAnimation("Dead Down", 7, 7, 10000000);
        mAnimator.CreateAnimation("Dead Left", 4, 4, 10000000);
        mAnimator.CreateAnimation("Dead Right", 5, 5, 10000000);
        //x = xPos;
        //y = yPos;

        hp = 3;
        //meleeDef = 0;
        //rangeDef = 0;

        lifeTime = 0;
        spreadThreshold = 20;

        startTime = Time.time;
        currentTime = 0;
    }
Beispiel #14
0
 protected override void Awake()
 {
     base.Awake();
     target.enabled = false;
     aniControl     = target.gameObject.AddComponent <CustomAnimator>();
 }
    public bool aiPickup2     = false; //used to initiate an item pickup

    protected virtual void Start()
    {
        physics  = GetComponent <PlayerPhysics>();
        animator = GetComponent <CustomAnimator>();
        box      = GetComponent <BoxCollider2D>();
        ai       = GetComponent <AiBase>();
        passives = new List <Item>();

        if (inputType == "Keyboard")
        {
            horizontal = "KB Horizontal";
            vertical   = "KB Vertical";
            jump       = "KB Jump";
            attack     = "KB Attack";
            special    = "KB Special";
            item1      = "KB Item1";
            item2      = "KB Item2";
            grab1      = "KB Grab1";
            grab2      = "KB Grab2";
            pause      = "KB Pause";
            select     = "KB Select";
        }
        else if (inputType == "Joy1")
        {
            horizontal = "Joy1 Horizontal";
            vertical   = "Joy1 Vertical";
            jump       = "Joy1 Jump";
            attack     = "Joy1 Attack";
            special    = "Joy1 Special";
            item1      = "Joy1 Item1";
            item2      = "Joy1 Item2";
            grab1      = "Joy1 Grab1";
            grab2      = "Joy1 Grab2";
            pause      = "Joy1 Pause";
            select     = "Joy1 Select";
        }
        else if (inputType == "Joy2")
        {
            horizontal = "Joy2 Horizontal";
            vertical   = "Joy2 Vertical";
            jump       = "Joy2 Jump";
            attack     = "Joy2 Attack";
            special    = "Joy2 Special";
            item1      = "Joy2 Item1";
            item2      = "Joy2 Item2";
            grab1      = "Joy2 Grab1";
            grab2      = "Joy2 Grab2";
            pause      = "Joy2 Pause";
            select     = "Joy2 Select";
        }
        else if (inputType == "Joy3")
        {
            horizontal = "Joy3 Horizontal";
            vertical   = "Joy3 Vertical";
            jump       = "Joy3 Jump";
            attack     = "Joy3 Attack";
            special    = "Joy3 Special";
            item1      = "Joy3 Item1";
            item2      = "Joy3 Item2";
            grab1      = "Joy3 Grab1";
            grab2      = "Joy3 Grab2";
            pause      = "Joy3 Pause";
            select     = "Joy3 Select";
        }
        else if (inputType == "Joy4")
        {
            horizontal = "Joy4 Horizontal";
            vertical   = "Joy4 Vertical";
            jump       = "Joy4 Jump";
            attack     = "Joy4 Attack";
            special    = "Joy4 Special";
            item1      = "Joy4 Item1";
            item2      = "Joy4 Item2";
            grab1      = "Joy4 Grab1";
            grab2      = "Joy4 Grab2";
            pause      = "Joy4 Pause";
            select     = "Joy4 Select";
        }
        else if (inputType == "AI")
        {
            ai.ourPlayer = this;//this activate the AI, essentially
            aiEnabled    = true;
        }

        //grab our overhead display
        GetComponent <PlayerOverhead>().connectedPlayer = this;
    }
Beispiel #16
0
 void Start()
 {
     PlayerMove     = GetComponent <PlayerMove>();
     audioSource    = GetComponent <AudioSource>();
     customAnimator = GetComponentInChildren <CustomAnimator>();
 }